ToTensorTransform<T>
Models & Types · AiDotNet.Data.Transforms.Numeric
Converts a flat array to a Tensor with the specified shape.
Implements: ITransform<T[], Tensor<T>>
For Beginners
When you load image data as a flat array of pixels, you need to reshape it into the correct dimensions (height x width x channels) for neural network input.
How It Works
This transform reshapes a 1D array of values into a multi-dimensional tensor. The total number of elements must match the product of the shape dimensions.
Constructors
| Constructor | Summary |
|---|---|
ToTensorTransform(int[] shape) |
Creates a transform that converts arrays to tensors with the specified shape. |
Methods
| Method | Summary |
|---|---|
Tensor<T> Apply(T[] input) |