vprokopev

vprokopev OP t1_j1j0xs5 wrote

Thank you for sharing experience!.

My intuition is that C++ python extensions make it easier to to easy things (then in C++) but make it harder to do hard things.

People always go for convenience first and then move to something more fundamental and flexible.

Data Science was mostly in R and MATLAB about 12-15 years ago. Then people moved to more general python. Next step is a compiled language with static types imo.

1

vprokopev OP t1_j0zy68v wrote

Mostly use vectorized pytorch operations.

Sometimes use just native loops and indexing.

Yes, unfortunately there are specific data preprocessing cases where I have to do stuff outside of pytorch, it's just more convenient.

And even when mostly using pytorch I still want the freedom to just use native functionality of a language without a huge hit to a performance.

But I know pytorch vectorized ops will still be faster and are suitable for majority of tasks

0

vprokopev OP t1_j0zu1ke wrote

But I do want to use pytorch, I like it very much.

I just usually have a lot of specific modifications to data and find myself avoiding native python and loops/indexing, because it makes things way slower.

It would still be slower if I implemented it in C++ then in pytorch, but at least not like way slower and would not create a bottleneck

−1

vprokopev OP t1_j0zt2rb wrote

Agree, what I am trying to say is C++ gives you more freedom here. In python it's just no way you can use native features in anything you want to run fast.

Vectorized operations are goated, I agree. But I don't want to be constrained to always use them. Especially when I have to write a lot of very specific modifications to data before I feed it to a NN.

−1

vprokopev OP t1_j0zrven wrote

I understand this. This is not answering my question.

Using python front end I must implement any algorithm I have in mind in terms of vectorized pytorch operations. I can't use loops and indexing and other python libraries, or my code will be slow and only executed with 1 core.

How that supposed to make my job easier?

−16

vprokopev OP t1_j0zqzxm wrote

Again, in C++ I am not so much constrained to only use Pytorch functions. I can use other libraries and native features.

In python I basically must express any algorithm I have in my head in terms of vectorized pytorch operations with broadcasting. Not the case in C++. Am I wrong here?

I am not taking about researchers, I am talking more about businesses. No problem with researchers using python.

−6

vprokopev OP t1_j0zo91k wrote

  1. But you have to use vectorized operations instead of loops, pytorch functions for everything you want to be fast etc... This is different from just using a library. It's ONLY using the library
  2. There are better languages that are also flexible and popular. And python is not so flexible anyway (GIL).
−14