Optional Nx interop for NOE tensor binaries.
Available only when the :nx dependency is present. NOE tensor descriptors
carry an element type and a flat byte size but not the logical shape, so
conversions default to a flat 1-D tensor; pass :shape to reshape.
{:ok, [out]} = CixP1.run(graph, [input])
{:ok, desc} = CixP1.Graph.output_descriptor(graph, 0)
tensor = CixP1.Nx.to_nx(out, desc, shape: {1, 1000})
probs = tensor |> CixP1.Nx.dequantize(desc) |> Nx.squeeze()
Summary
Functions
Dequantizes an integer tensor using the descriptor's :scale and
:zero_point: real = (q - zero_point) * scale.
Serializes tensor to a raw binary suitable for CixP1.Job.load_input/3,
validating its element type and byte size against descriptor.
Maps a descriptor's :data_type to an Nx type tuple, or :error.
Builds an Nx.Tensor from a raw NOE tensor binary and its descriptor.
Functions
@spec dequantize(Nx.Tensor.t(), CixP1.Graph.descriptor()) :: Nx.Tensor.t()
Dequantizes an integer tensor using the descriptor's :scale and
:zero_point: real = (q - zero_point) * scale.
Returns the tensor unchanged when scale is 0.0 (non-quantized output).
@spec from_nx(Nx.Tensor.t(), CixP1.Graph.descriptor()) :: {:ok, binary()} | {:error, String.t()}
Serializes tensor to a raw binary suitable for CixP1.Job.load_input/3,
validating its element type and byte size against descriptor.
@spec nx_type(CixP1.Graph.descriptor()) :: {atom(), pos_integer()} | :error
Maps a descriptor's :data_type to an Nx type tuple, or :error.
@spec to_nx(binary(), CixP1.Graph.descriptor(), keyword()) :: Nx.Tensor.t()
Builds an Nx.Tensor from a raw NOE tensor binary and its descriptor.
Options:
:shape— logical shape to reshape into (default: flat{n})
Quantization is not applied here — use dequantize/2 on the result.