Live data from Hacker News

PyTorch 1.0 is out

github.com

51–60 of 72 posts

Re: PyTorch 1.0 is out

#51

Earlier quoted context omitted.

I recently encountered code (at work no less) that overloaded the == operator. a.) It was not a const overload. b.) Inside said overload, it modified FOUR member variables. c.) The 'new' keyword was used twice inside said == overload. d.) I learned when gdb fails, to grep the codebase for the 'operator' keyword. I am not a fan of operator overloading. If the SW enginner in question had instead written a equals( rhs)…

Sounds like operator overloading isn't the real problem here. An function equals(T rhs) -> bool that calls new and modifies member variables still sounds pretty terrible; changing "==" to "equals" doesn't fix the problem.

The difference is in the time it takes to track down the aberrant behavior, and the learning opportunities available.

In the named case, it's obvious the other programmer may be doing something nefarious.

In the operator case, you learn much more, like how to grep, really work gdb, etc.

Re: PyTorch 1.0 is out

#53
post #18

Earlier quoted context omitted.

i picked up c++ for some gpu stuff with the arrayfire api... felt the same. firstly, modern c++ takes no time to learn if you come from java / c/ c# / etc. secondly, things like operator overloading and type inference make for pretty seamless apis. E.g. want to add matrices? auto C = A + B. A lot of things suck (closures, generator functions, first order functions all suck in c++), but oh my does it all run fast when…

Why do closures suck? What are they missing?

I like to pass closures as return values or as function parameters. In my experience this is folly in c++.

Re: PyTorch 1.0 is out

#54
post #33
post #21

Earlier quoted context omitted.

I'm not sure how I feel about operator overloading. It starts out simple enough, but can lead to extremely confusing code. Take this snippet of an API call[1] that parses ISO strings to chrono::time_point using date[2]: std::istringstream in(iso_string); in >> date::parse("%FT%TZ", tp); At first glace my brain cannot comprehend the second statement. Why is there an input stream going into a function ? Is that even va…

> Why is there an input stream going into a function ? The function is constructing a temporary object and reading into that object . The object includes a reference to a named tp object, and the temporary parser object is parsing from the input stream, which writes the data into the tp object. > but... I still don't understand all of the technical reasons behind that decision. Because he wants to support input from…

Maybe because my background coming into C++ was Turbo Pascal, and I already knew OOP from 5.5 and 6.0, including a nice experience with Turbo Vision and its stream framework, introduced with Turbo Pascal 6.0.

I never grasped the hate iostreams get, as they are type safe and composable in ways that FILE will never be.

Sure they might be a couple of ms slower than stdio calls, but unless I would be writing a HPC trading application communicating over stdio, I hardly see the relevance.

And for the operators, oh well, as long as they are consistent.

Then again, it might just be my biased background as I got introduced to them.

Re: PyTorch 1.0 is out

#55
post #12

What surprised me most is the elegance of C++ API. Compared to its equivalence in Python, the C++ version is almost the same if we discard the "auto" keyword [0]. As mentioned in the doc, they put user-friendliness over micro-optimizations, which also proves the expressiveness of modern C++ (at least when they want to prioritize user-friendliness!) [0]: https://pytorch.org/cppdocs/frontend.html#end-to-end-example

So cool to see people saying good things about C++ and I've never had the chance to take a uni course on computer science but I've always wanted to the GUI stuff with C and C++. Maybe I should try again. Thanks OP. :)

Re: PyTorch 1.0 is out

#57
post #6

The new JIT is very interesting. Anyone know if this is for inference only or also for training?

I wonder what is "just in time" about that compiler, does anyone know? If you want to compile your python code so that it can run in C++, then you'll have to statically compile, no?

Re: PyTorch 1.0 is out

#58
post #30

What would be a good book and project to get started with this? Object recognition? Product recommendations?

I would suggest going through the Fast.AI course [1]. It's an excellent course to learn more about DL in general, and some of torch API. The downside is that the course material was produced when PyTorch was still at 0.3, so some of the API has changed since then. [1] https://course.fast.ai/

A new version for PyTorch v1 will be released next month, FYI.

Re: PyTorch 1.0 is out

#59
post #27
post #14

TL;DR - New JIT feature that lets you run your model without python. It now seems trivial to load a pytorch model in C++ - New distributed computation package. Major redesign. - C++ frontend - New torch hub feature to load models from github easily

I love PyTorch, but my experience with jits embedded in Python (eg. Numba) has been everything but simple, nevermind trivial. I'll really have to try it to believe it.

I’ve had the opposite experience with numba in production. It works almost flawlessly, very easy to reason about the generated code and inspect annotations, easy to debug.
Post reply on HN