TensorExtensions

Helpers & Utilities · AiDotNet.Extensions

No summary documentation available yet.

Methods

Method Summary
Matrix<T> ConvertToMatrix(Tensor<T> tensor) Converts a tensor to a matrix for various calculations.
Tensor<T> ConcatenateTensors(Tensor<T> tensorA, Tensor<T> tensorB) Concatenates two tensors along the last dimension.
Tensor<T> CreateOnesTensor(int size) Creates a tensor initialized with all ones.
Tensor<T> CreateXavierInitializedTensor(int[] shape, double stddev, Random random) Creates and initializes a tensor with Xavier/Glorot initialization using random values.
Tensor<T> Unflatten(Tensor<T> tensor, Vector<T> flattenedValues) Converts a flattened vector back into a tensor with the specified shape.
bool TensorEquals(Tensor<T> a, Tensor<T> b)
double HeStddev(int fanIn) Calculates the He standard deviation for weight initialization with ReLU activations.
double XavierStddev(int fanIn, int fanOut) Calculates the Xavier/Glorot standard deviation for weight initialization.
void ForEachPosition(Tensor<T> tensor, Func<int[], T, bool> action) Iterates through all positions in the tensor and applies a function to each position.