Live data from Hacker News

Tinn: A tiny neural network library written in C99

github.com

21–30 of 62 posts

Re: Tinn: A tiny neural network library written in C99

#21
post #14

Earlier quoted context omitted.

This does nor preclude the use of threads or SIMD. Essentially this library is a demo toy that will need a lot to work to make useful in real conditions.

> Essentially this library is a demo toy It's 200 lines of C, what were you expecting?

Generally when I see links to github projects on HN I expect something useful or extraordinary and this looks like my Neural Networks 101 assignment, only far more polished. But people seem to like it(over 400 stars right now) so maybe I am missing something.

Re: Tinn: A tiny neural network library written in C99

#22
post #19

Just curious, is there a reason for passing around the Tinn struct by-value? Will it get optimized?

It's commonly optimized out, yes. Rule of thumb is typically to pass pointers to a struct if it gets fairly large and complex. Even then, you should really profile to see that the becomes a bottleneck, compilers inline aggressively and a pointer might defeat some other optimizations down the call chain.

Re: Tinn: A tiny neural network library written in C99

#23
post #3

Single core? No AVX? What's the point of writing it in C?

Writing clean C loops are a good way of writing vectorized code.

Checking the vectorization report of icc 2018 for fprop() shows that the loops got inlined, unrolled and vectorized (with AVX512 and AVX2 instructions using XMM/YMM registers). I doubt that doing it by hand would be faster, but it would make the code a lot more complex.

You have a point on the parallelization part though, it can be cleanly parallelized with a few OpenMP Pragmas.

Re: Tinn: A tiny neural network library written in C99

#24
post #19

Just curious, is there a reason for passing around the Tinn struct by-value? Will it get optimized?

It might get optimized by inlining, these functions are pretty small and would make good candidates.

Passing small structs by value isn't as expensive as it once was, modern ABIs pass the initial fields in registers. However, this struct does have ten pointer/integer fields, and I'm not aware of a mainstream ABI that allows that many. x86-64 allows up to six on Linux, IIRC. A quick check of the AArch64 ABI says it takes up to eight. So yeah, there will be stack traffic involved if these function calls are not inlined.

Re: Tinn: A tiny neural network library written in C99

#26
post #14

Earlier quoted context omitted.

> Essentially this library is a demo toy It's 200 lines of C, what were you expecting?

Generally when I see links to github projects on HN I expect something useful or extraordinary and this looks like my Neural Networks 101 assignment, only far more polished. But people seem to like it(over 400 stars right now) so maybe I am missing something.

People like it because it does what it says on the tin without any further dependencies and having to pull in the entire planet, as with the respective node.js binaries.

Re: Tinn: A tiny neural network library written in C99

#27
post #14

Earlier quoted context omitted.

> Essentially this library is a demo toy It's 200 lines of C, what were you expecting?

Generally when I see links to github projects on HN I expect something useful or extraordinary and this looks like my Neural Networks 101 assignment, only far more polished. But people seem to like it(over 400 stars right now) so maybe I am missing something.

So... if its usefulness is equal to something you've made, AND it's available to the public, AND it's more polished... why exactly are you shitposting about it?

Let people enjoy things.

Re: Tinn: A tiny neural network library written in C99

#28

Earlier quoted context omitted.

Generally when I see links to github projects on HN I expect something useful or extraordinary and this looks like my Neural Networks 101 assignment, only far more polished. But people seem to like it(over 400 stars right now) so maybe I am missing something.

So... if its usefulness is equal to something you've made, AND it's available to the public, AND it's more polished... why exactly are you shitposting about it? Let people enjoy things.

I just pointed out that this is a very basic code. It's definitely not something I would use in any real life scenario(see other posts itt). And if you want to learn about NN you'd be better off googling something like 'backpropagation example' as this project does is virtually not documented. I personally don't find it useful and it takes up the space that can be filled with more interesting content. How is that 'shitposting'?

Re: Tinn: A tiny neural network library written in C99

#30

Earlier quoted context omitted.

So... if its usefulness is equal to something you've made, AND it's available to the public, AND it's more polished... why exactly are you shitposting about it? Let people enjoy things.

I just pointed out that this is a very basic code. It's definitely not something I would use in any real life scenario(see other posts itt). And if you want to learn about NN you'd be better off googling something like 'backpropagation example' as this project does is virtually not documented. I personally don't find it useful and it takes up the space that can be filled with more interesting content. How is that 'sh…

It's a refreshingly clean, tiny library without dependencies that can do some cool stuff. Let people like things. Stop shitposting.
Post reply on HN