r/javascript • • Mar 30 '18

TensorFlow.js

https://js.tensorflow.org/
471 Upvotes

101 comments sorted by

View all comments

101

u/CiezkiBorsuk Mar 30 '18

we are actively working on creating node.js bindings to the TensorFlow C API

This makes me so happy, because when they are done I lose the last reason to ever use Python in my life ^-^

30

u/2Punx2Furious Mar 30 '18

You don't like Python?

75

u/gavrocheBxN Mar 30 '18

I like Python but I love TypeScript

6

u/SamSlate Mar 30 '18

what can you do with type you can't with vanilla? (serious question)

82

u/aaaqqq Mar 30 '18

refactor large code bases with impunity

→ More replies (5)

0

u/[deleted] Mar 30 '18

[deleted]

4

u/SamSlate Mar 30 '18

weird, I've never had an issue with js' loose types, but i hear a lot of criticism for js on the type system..

→ More replies (1)

5

u/SahinK Mar 31 '18

Amazing intellisense. Autocompletions for everything. No need to keep checking documentation or stackoverflow to find out what methods are available to you or what arguments to pass to an API. No easily avoidable runtime errors. Much easier to read and understand other people's code.

I would never go back to plain JavaScript.

→ More replies (1)

6

u/2Punx2Furious Mar 30 '18

Nothing really, as far as I know TypeScript just compiles to regular JavaScript.

It just has some helpful features to make your life easier.

29

u/calsosta Mar 30 '18

Why do you want an easy life?

4

u/2Punx2Furious Mar 30 '18

Life is hard enough as it is.

I like some challenge, but I value time more.

2

u/fizzy_tom Mar 30 '18

What value does time give you?

→ More replies (3)
→ More replies (1)

3

u/CiezkiBorsuk Mar 30 '18

what can you do with vanilla that you can't do with TS?

→ More replies (2)

8

u/CiezkiBorsuk Mar 30 '18 edited Mar 30 '18

No, I don't. I find it really hard to read code with minimal punctuation.

It was easier to learn than most languages because of that, but once I know something else, I really see no reason to use Py, unless I have to.

4

u/nickguletskii200 Mar 30 '18 edited Mar 30 '18

No, I don't. Code without types is unreadable because it requires me to remember the flow of information. I would really love to use TensorFlow from Scala, Java, C# or TypeScript. Ideally, there would be a language for machine learning that does compile-time dimension checks (you can probably do something like that with templates in C++, but package management isn't a thing in the world of C++).

Just try reading some of the code in the research TensorFlow models. It sucks. Not because the concepts behind it are hard, but because a ton of information is hidden.

Also, Python's lack of a strict project structure is very annoying. I can take any modern JVM project and it will follow a strict hierarchy, with a proper, unified place for dependencies (Maven POM, Gradle build file or SBT build definition), while even big companies such as Google don't set up the Python projects consistently.

EDIT: Also, fuck the lack of punctuation. Goddamn Google and their 2-space tabs, so infuriating! I just want my auto-indent!

2

u/raiderrobert Mar 30 '18

Python 3.6 has type annotations: https://docs.python.org/3/library/typing.html

But I admit that project organization has room for improvement.

3

u/Jugad Mar 30 '18

I am not sure if project organization belongs in the language, specially since projects can be so different... a web project directory structure has very little in common with an ML project, or a desktop GUI project (yes, I make desktop GUI programs using wxPython).

If you are talking at a very high level ... directories like src, test, documentation, build, etc at the top level, maybe that makes some sense. But I wonder how much does it actually help.

1

u/nickguletskii200 Mar 30 '18 edited Mar 30 '18

I know about the type annotations. The problem is that pretty much nobody else uses them, and they don't seem to be very expressive.

2

u/raiderrobert Mar 30 '18

Could you elaborate on the expressiveness part. I've used C#, C, and Rust before. If any of those help explain what you mean, that would be great.

→ More replies (1)

2

u/Jugad Mar 30 '18

The problem is that pretty much nobody else uses them

I thought every typed language uses them... I know this might come across as snarky, but seriously, can you explain what's the basic difference between type annotations/information in Python and, say, Java?

they don't seem to be very expressive

Why are they not expressive?

→ More replies (1)

2

u/antespo Mar 30 '18

I guess if your mainly a js developer then having to jump to python for tensorflow could be alittle annoying. I mainly use python and js secondary so I may be biased but I think if you wanna use tensorflow python is the way to go, at least for now. Regardless I am looking forward to using tensorflow in js.

5

u/2Punx2Furious Mar 30 '18

I get it.

I mainly use JS/TypeScript, but I also really like Python, even if it's been a while since last time I used it, switching back and forth between languages can be annoying.

1

u/Faendol Apr 25 '18

I really dont like that it doesnt have semicolons. I just can't get over it.

→ More replies (1)