GPUTensor<T>.matrix constructor

GPUTensor<T>.matrix(
  1. Matrix initialValue, {
  2. GPUNode? creator,
  3. String id = "EMPTY",
  4. bool? requiresGrad,
})

Implementation

GPUTensor.matrix(Matrix initialValue, {this.creator, this.id = "EMPTY", bool? requiresGrad}) {
  localGrad = requiresGrad ?? globalGrad;
  if (id == "EMPTY") {
    id = _generateId();
  }
  int rows = initialValue.length;
  int cols = rows > 0 ? initialValue[0].length : 0;
  shape = [rows, cols];
  _allocateEmptyInVram();
  _pushInitialValue(initialValue);
}