zeros

  1. Tensor!(T, Shape, useGrad) zeros()
    Tensor!(T, Shape, useGrad)
    zeros
    (
    T
    size_t[] Shape
    )
    ()
    if (
    Shape[0] != 0
    )
  2. Tensor!(T, Shape, useGrad) zeros(size_t batchSize)

Examples

ditto

auto z = zeros!(float, [2, 2]);
assert(z.shape == [2, 2]);
assert(z.value[0, 0] == 0);
assert(z.value[0, 1] == 0);
assert(z.value[1, 0] == 0);
assert(z.value[1, 1] == 0);

ditto

auto z = zeros!(float, [2, 2], UseGradient.yes);
assert(z.shape == [2, 2]);
assert(z.value[0, 0] == 0);
assert(z.value[0, 1] == 0);
assert(z.value[1, 0] == 0);
assert(z.value[1, 1] == 0);

Meta