zeros

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

Examples

ditto

auto z = zeros!(float, [0, 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, [0, 2], UseGradient.yes)(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);

Meta