Nx Tensors
Mix.install([
{:nx, "~> 0.9.1"}
])
Creating a tensor
tensor = Nx.tensor([1, 2, 3, 4])
Applying a transformation that updates the tensor
updated_tensor = Nx.add(tensor, 10)
Showing the updated tensor
IO.inspect(updated_tensor) # Updated tensor
Showing the original tensor
IO.inspect(tensor) # Original tensor
Another tensor
another_tensor = Nx.tensor([[1, 2, 3], [4,5,6], [7,8,9]])
Nx.add(another_tensor, 3)
[[0,1], [2, 3]]
|> Nx.tensor()
|> Nx.all()