GPUTensor<T>.randomUniform constructor

GPUTensor<T>.randomUniform(
  1. List<int> initialShape,
  2. double scale, {
  3. int? seed,
  4. GPUNode? creator,
  5. bool? requiresGrad,
})

Create a GPUTensor with the given shape and fills the GPUTensor with random initialised values in range of provided scale parameter. Additionally the creator GPUNode can be set as well as a seed for randomization.

Implementation

GPUTensor.randomUniform(List<int> initialShape, double scale,
    {int? seed, 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();

  int finalSeed = seed ?? Random().nextInt(9999999);
  GPUEngine.initRandomUniform(id, scale, finalSeed);
}