Tensorex.reshape

You're seeing just the function reshape, go back to Tensorex module for more information.
Link to this function

reshape(tensorex, shape)

View Source

Specs

reshape(t(), [pos_integer(), ...]) :: t()

Updates dimensions of each order.

If new shape has larger dimension than previous one, values at the increased indices are considered to be zero. Otherwise if new shape has less dimension, it discards values at the removed indices.

iex> Tensorex.reshape(Tensorex.from_list([[[ 1,  2,  3],
...>                                       [ 4,  5,  6],
...>                                       [ 7,  8,  9]],
...>                                      [[-1, -2, -3],
...>                                       [-4, -5, -6],
...>                                       [-7, -8, -9]]]), [2, 2, 3])
%Tensorex{data: %{[0, 0, 0] =>  1, [0, 0, 1] =>  2, [0, 0, 2] =>  3,
                  [0, 1, 0] =>  4, [0, 1, 1] =>  5, [0, 1, 2] =>  6,
                  [1, 0, 0] => -1, [1, 0, 1] => -2, [1, 0, 2] => -3,
                  [1, 1, 0] => -4, [1, 1, 1] => -5, [1, 1, 2] => -6}, shape: [2, 2, 3]}

iex> Tensorex.reshape(Tensorex.from_list([[[ 1,  2,  3],
...>                                       [ 4,  5,  6],
...>                                       [ 7,  8,  9]],
...>                                      [[-1, -2, -3],
...>                                       [-4, -5, -6],
...>                                       [-7, -8, -9]]]), [3, 3, 3])
%Tensorex{data: %{[0, 0, 0] =>  1, [0, 0, 1] =>  2, [0, 0, 2] =>  3,
                  [0, 1, 0] =>  4, [0, 1, 1] =>  5, [0, 1, 2] =>  6,
                  [0, 2, 0] =>  7, [0, 2, 1] =>  8, [0, 2, 2] =>  9,
                  [1, 0, 0] => -1, [1, 0, 1] => -2, [1, 0, 2] => -3,
                  [1, 1, 0] => -4, [1, 1, 1] => -5, [1, 1, 2] => -6,
                  [1, 2, 0] => -7, [1, 2, 1] => -8, [1, 2, 2] => -9}, shape: [3, 3, 3]}

iex> Tensorex.reshape(Tensorex.from_list([[[ 1,  2,  3],
...>                                       [ 4,  5,  6],
...>                                       [ 7,  8,  9]],
...>                                      [[-1, -2, -3],
...>                                       [-4, -5, -6],
...>                                       [-7, -8, -9]]]), [3, 2, 2])
%Tensorex{data: %{[0, 0, 0] =>  1, [0, 0, 1] =>  2,
                  [0, 1, 0] =>  4, [0, 1, 1] =>  5,
                  [1, 0, 0] => -1, [1, 0, 1] => -2,
                  [1, 1, 0] => -4, [1, 1, 1] => -5}, shape: [3, 2, 2]}