Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 361 Bytes

nx.livemd

File metadata and controls

33 lines (25 loc) · 361 Bytes

Nx

Mix.install([
  {:nx, "~> 0.6.4"}
])

Tensor Creation

data = [[1, 2], [3, 4], [5, 6]]
tensor = data |> Nx.tensor()

Tensor Operations

tensor |> Nx.to_heatmap()
tensor |> Nx.shape()
tensor |> Nx.exp()
# softmax
Nx.divide(Nx.exp(tensor), Nx.sum(Nx.exp(tensor)))