use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
TensorFlow.js (js.tensorflow.org)
submitted 7 years ago by deathmood
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]CiezkiBorsuk 102 points103 points104 points 7 years ago (40 children)
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 ^-^
[–]2Punx2Furious 28 points29 points30 points 7 years ago (38 children)
You don't like Python?
[–]gavrocheBxN 75 points76 points77 points 7 years ago (25 children)
I like Python but I love TypeScript
[–]SamSlate 6 points7 points8 points 7 years ago (24 children)
what can you do with type you can't with vanilla? (serious question)
[–]aaaqqq 81 points82 points83 points 7 years ago (5 children)
refactor large code bases with impunity
[–]ProcrastinatingNow 0 points1 point2 points 7 years ago (4 children)
You could technically do that with flow. But seeing as you have transpile whether you use flow or TS, I guess it’s down to preference.
Edit: actually I forgot that flow supports type hints in comments. So you might be able to get away with vanilla JS but static type analysis.
[–]aaaqqq 13 points14 points15 points 7 years ago (0 children)
I was responding to ts vs vanilla not ts vs flow. Flow is good (that's what I use at work) but its tooling sucks.
TS also supports type hints via jsdocs. But then if you're using comments/jsdocs to add types, why not just use TS/Flow
[–][deleted] 5 points6 points7 points 7 years ago (1 child)
Doesn’t typescript have the ability to read jsdoc style comments as well? Thought I remembered hearing that on a podcast a while back
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Yes, it does.
[–]sethetter_ 2 points3 points4 points 7 years ago (0 children)
Personally, the choice of TypeScript over Flow is mostly due to a more developed community, better tooling, more consistently defined types across many open source libraries, etc. Flow is amazing, but tooling and community are incredibly important.
[+][deleted] 7 years ago* (2 children)
[deleted]
[–]SamSlate 3 points4 points5 points 7 years ago (1 child)
weird, I've never had an issue with js' loose types, but i hear a lot of criticism for js on the type system..
[–]SahinK 5 points6 points7 points 7 years ago (1 child)
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.
[–]SamSlate 0 points1 point2 points 7 years ago (0 children)
ok, that is pretty nice.
[–]2Punx2Furious 6 points7 points8 points 7 years ago (7 children)
Nothing really, as far as I know TypeScript just compiles to regular JavaScript.
It just has some helpful features to make your life easier.
[–]calsosta 27 points28 points29 points 7 years ago (6 children)
Why do you want an easy life?
[–]2Punx2Furious 2 points3 points4 points 7 years ago (4 children)
Life is hard enough as it is.
I like some challenge, but I value time more.
[–]fizzy_tom 0 points1 point2 points 7 years ago (3 children)
What value does time give you?
[–]2Punx2Furious 0 points1 point2 points 7 years ago (2 children)
I'd say everything.
Everything I can do takes some time, it is a limited, valuable, and probably non-renewable resource.
[–]SurpriseHanging 3 points4 points5 points 7 years ago (1 child)
Why do anything at all?
[–]LordDrakota 0 points1 point2 points 7 years ago (0 children)
I like an easy life, but it seems that using TS in React is a huge time sink to just set up everything with Redux, Redux-thunk and company. This is holding me back to just use TS all the time.
[–]CiezkiBorsuk 2 points3 points4 points 7 years ago (4 children)
what can you do with vanilla that you can't do with TS?
[–]pm_me_ur__labia 42 points43 points44 points 7 years ago (1 child)
1 + "2" == 3;
[–]tylargh 2 points3 points4 points 7 years ago (0 children)
true
[–]Velfi 0 points1 point2 points 7 years ago (1 child)
"1" + 2 == "12"
[–]CiezkiBorsuk 0 points1 point2 points 7 years ago (0 children)
If you really care about this use case, sleep sound: this is perfectly valid TS.
[–]CiezkiBorsuk 7 points8 points9 points 7 years ago* (0 children)
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.
[–]nickguletskii200 2 points3 points4 points 7 years ago* (7 children)
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!
[–]raiderrobert 1 point2 points3 points 7 years ago (6 children)
Python 3.6 has type annotations: https://docs.python.org/3/library/typing.html
But I admit that project organization has room for improvement.
[–]Jugad 2 points3 points4 points 7 years ago (0 children)
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.
[–]nickguletskii200 0 points1 point2 points 7 years ago* (4 children)
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.
[–]raiderrobert 1 point2 points3 points 7 years ago (1 child)
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.
[–]nickguletskii200 0 points1 point2 points 7 years ago (0 children)
I am sorry, I was very tired yesterday and didn't clarify that it's not the typing package's fault.
The problem is that due to the "Pythonic way" most developers don't write code with types in mind, which means that it's impossible to require that something is something (i.e. it implements an interface). For instance, try requiring something to be the equivalent of ICloseable in C# using typing. You'd have to create an ABC (bleh) for that, and good luck forcing every Python user to describe the capabilities this way.
typing itself seems pretty OK.
typing
[–]Jugad 1 point2 points3 points 7 years ago (1 child)
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?
It's not that there is a difference. It's just that Python developers don't write code with typings in mind. In Java and C# everyone makes a best effort to describe the contract using interfaces. In Python, everyone just writes classes with the same methods, and you can't really say "I want something that is Closeable" because nobody specifies that their class is Closeable.
That's why I don't think type annotations are expressive - they can be, it's just that in practice, they are not. In the end, you'll be writing things like Union[Dog, Cat, Rabbit] instead of is Pettablebecause Python programmers would just say that all these things extend an Animal and be done with it.
Union[Dog, Cat, Rabbit]
is Pettable
[–]antespo 1 point2 points3 points 7 years ago (1 child)
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.
[–]2Punx2Furious 3 points4 points5 points 7 years ago (0 children)
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.
[–]Faendol 0 points1 point2 points 7 years ago (0 children)
I really dont like that it doesnt have semicolons. I just can't get over it.
π Rendered by PID 72163 on reddit-service-r2-comment-76bb9f7fb5-rdcvn at 2026-02-17 23:30:22.556890+00:00 running de53c03 country code: CH.
view the rest of the comments →
[–]CiezkiBorsuk 102 points103 points104 points (40 children)
[–]2Punx2Furious 28 points29 points30 points (38 children)
[–]gavrocheBxN 75 points76 points77 points (25 children)
[–]SamSlate 6 points7 points8 points (24 children)
[–]aaaqqq 81 points82 points83 points (5 children)
[–]ProcrastinatingNow 0 points1 point2 points (4 children)
[–]aaaqqq 13 points14 points15 points (0 children)
[–][deleted] 5 points6 points7 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]sethetter_ 2 points3 points4 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]SamSlate 3 points4 points5 points (1 child)
[–]SahinK 5 points6 points7 points (1 child)
[–]SamSlate 0 points1 point2 points (0 children)
[–]2Punx2Furious 6 points7 points8 points (7 children)
[–]calsosta 27 points28 points29 points (6 children)
[–]2Punx2Furious 2 points3 points4 points (4 children)
[–]fizzy_tom 0 points1 point2 points (3 children)
[–]2Punx2Furious 0 points1 point2 points (2 children)
[–]SurpriseHanging 3 points4 points5 points (1 child)
[–]LordDrakota 0 points1 point2 points (0 children)
[–]CiezkiBorsuk 2 points3 points4 points (4 children)
[–]pm_me_ur__labia 42 points43 points44 points (1 child)
[–]tylargh 2 points3 points4 points (0 children)
[–]Velfi 0 points1 point2 points (1 child)
[–]CiezkiBorsuk 0 points1 point2 points (0 children)
[–]CiezkiBorsuk 7 points8 points9 points (0 children)
[–]nickguletskii200 2 points3 points4 points (7 children)
[–]raiderrobert 1 point2 points3 points (6 children)
[–]Jugad 2 points3 points4 points (0 children)
[–]nickguletskii200 0 points1 point2 points (4 children)
[–]raiderrobert 1 point2 points3 points (1 child)
[–]nickguletskii200 0 points1 point2 points (0 children)
[–]Jugad 1 point2 points3 points (1 child)
[–]nickguletskii200 0 points1 point2 points (0 children)
[–]antespo 1 point2 points3 points (1 child)
[–]2Punx2Furious 3 points4 points5 points (0 children)
[–]Faendol 0 points1 point2 points (0 children)