Advent of Code 2021 in pure TensorFlow – day 1
pgaleone.eu
pgaleone.eu
Btw link to GitHub repo is broken. Copy&pasting URL works.
[0] https://pytorch.org/docs/stable/jit_language_reference.html#...
IMO it's a huge advantage to be able to write torch model code that looks like how you'd write the same program in pure python, and still have them be serializable.
But the author choose to make the TF logic more explicitly visible, and use abstractions like tf.Module (like torch.nn.Module), the dataset, etc. I'm not sure this really makes so much sense. I guess this is more for just playing around.
Day 8 "FML!" checks python version installed...
Let's see if I'm able to face them all (that's also my first year that I join the AoC - so it's totally new for me)
Was hoping to see some training of a model to produce outputs. Good effort nonetheless!
If in the other puzzles there's some optimization problem that can be expressed in a differentialble way, then I'd use ML for sure. But until there exist a deterministic solution, ML is just a waste (I say this as a ML researcher :) )
That's unfortunate
All the comparisons like > are better written using their TensorFlow equivalent (e.g tf.greater). Autograph can convert them (you could write >), but it’s less idiomatic and I recommend to do not relying upon the automatic conversion, for having full control.
...but I'm not sure you realized that the for loop and the if statement in your code are being transparently compiled to dataset.map() and tf.cond() for you by Autograph :)Even if now autograph is able to convert them correctly, I still prefer to have every operator explicitly converted whenever possibile. The loop, luckily, never had this transpilation problems
It would be a great introduction to these frameworks for people who never touched anything ML-related, leaving the neural network content to later in the learning process.
Learning how to create differentiable algorithms and neural networks would be easier once the way those frameworks work is understood (ingesting data, iterating dataset, running, debugging, profiling, etc).
If you are starting with neural networks or differentiable programming, learning both the maths and the frameworks at the same time can be quite overwhelming