Tensorex.from_list
You're seeing just the function
from_list
, go back to Tensorex module for more information.
Specs
Creates a new tensor from a list (of lists (of lists of ...)).
iex> Tensorex.from_list([1.1, 2.1, -5.3, 4])
%Tensorex{data: %{[0] => 1.1, [1] => 2.1, [2] => -5.3, [3] => 4}, shape: [4]}
iex> Tensorex.from_list([[1.1, 2.1, -5.3, 4 ],
...> [0.8, -8, 21.4, 3.3]])
%Tensorex{data: %{[0, 0] => 1.1, [0, 1] => 2.1, [0, 2] => -5.3, [0, 3] => 4 ,
[1, 0] => 0.8, [1, 1] => -8, [1, 2] => 21.4, [1, 3] => 3.3}, shape: [2, 4]}
iex> Tensorex.from_list([[[0.0, 0.0, 0.0],
...> [0.0, 0.0, 0.0]],
...> [[0.0, 0.0, 0.0],
...> [0.0, 0.0, 0.0]]])
%Tensorex{data: %{}, shape: [2, 2, 3]}