elixir-nx / nx

Multi-dimensional arrays (tensors) and numerical definitions for Elixir
2.66k stars 194 forks source link

Fix Nx exercises solution #1503

Closed davydog187 closed 5 months ago

davydog187 commented 5 months ago

Create a tensor with values ranging from 10 to 49.

Solution 1 is

Nx.iota({39})
|> Nx.add(10)

Which produces

  s64[39]
  [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]
>

Other solutions are inclusive ranges, so the the solution should be

Nx.iota({40})
|> Nx.add(10)
josevalim commented 5 months ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart: