GPUTensor<T>.empty constructor

GPUTensor<T>.empty(
  1. List<int> initialShape, {
  2. GPUNode? creator,
  3. bool? requiresGrad,
})

Create a GPUTensor with the given shape and fills the GPUTensor with 0.0. Additionally the creator GPUNode can be set.

Implementation

GPUTensor.empty(List<int> initialShape, {this.creator, bool? requiresGrad}) : id = _generateId() {
  localGrad = requiresGrad ?? globalGrad;
  shape = <int>[];
  for (int i = 0; i < initialShape.length; i = i + 1) {
    shape.add(initialShape[i]);
  }
  _allocateEmptyInVram();
}