You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know how to do a clean pull request on a .ipynb so I'm just dropping things here in case you want to fix:
(1) puzzle 18 - linspace is making a lot of warnings
<ipython-input-398-250908f931bc>:4: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
out[k] = float(i + (j - i) * k / max(1, len(out) - 1))
this is fixed by adding: i, j = i[0], j[0] at the start of the function so that it becomes:
def linspace_spec(i, j, out):
i, j = i[0], j[0]
for k in range(len(out)):
out[k] = float(i + (j - i) * k / max(1, len(out) - 1))
(2) puzzle 18 - linspace in the youtube walkthrough https://youtu.be/Hafo7hIl8MU?t=3955
the solution use a max() it feels like cheating (don't use sum, and other builtins) so maybe instead:
return arange(n) * (j - i) / ((1 > (n - 1)) * 1 + (1 <= (n - 1)) * (n - 1)) + i # emulate a max
(3) the colab format is broken for "puzzle 21 bucketize", and "speed run" they appear as a comment inside the previous python cell instead of a markdown cell.
(4) what you are measure in the bonus at the very end is "code golf" not "speed run" because the runtime aren't very good, it's just the code length :)
PS:
Doing the puzzle felt a bit like doing lambda calculus but for tensors, very very basic building blocks but "turing complete" set of problems we can solve. That was really fun!
The text was updated successfully, but these errors were encountered:
Thank you for the cool puzzles!
I don't know how to do a clean pull request on a .ipynb so I'm just dropping things here in case you want to fix:
(1)
puzzle 18 - linspace
is making a lot of warningsthis is fixed by adding:
i, j = i[0], j[0]
at the start of the function so that it becomes:(2)
puzzle 18 - linspace
in the youtube walkthrough https://youtu.be/Hafo7hIl8MU?t=3955the solution use a
max()
it feels like cheating (don't use sum, and other builtins) so maybe instead:(3) the colab format is broken for "puzzle 21 bucketize", and "speed run" they appear as a comment inside the previous python cell instead of a markdown cell.
(4) what you are measure in the bonus at the very end is "code golf" not "speed run" because the runtime aren't very good, it's just the code length :)
PS:
Doing the puzzle felt a bit like doing lambda calculus but for tensors, very very basic building blocks but "turing complete" set of problems we can solve. That was really fun!
The text was updated successfully, but these errors were encountered: