repeat

Repeats the output of an operation along each axis the given number of times.

  1. Operation repeat(Operation input, size_t[] repetitions, string mod = __MODULE__, size_t line = __LINE__)
    repeat
    (
    ,
    size_t[] repetitions
    ,
    string mod = __MODULE__
    ,
    size_t line = __LINE__
    )
  2. Operation repeat(Operation input, size_t repetitions, string mod = __MODULE__, size_t line = __LINE__)

Parameters

input
Type: Operation

The operation to have its output repeated.

repetitions
Type: size_t[]

The number of repetitions to perform along each axis.

Return: The new Operation.

Examples

1 import dopt.core : evaluate;
2 
3 auto r1 = float32([1, 1], [3.0f]).repeat([2, 3]);
4 auto r2 = float32([2, 2], [1.0f, 2.0f, 3.0f, 4.0f]).repeat([3, 2]);
5 
6 assert(r1.evaluate().as!float == [
7     3.0f, 3.0f, 3.0f,
8     3.0f, 3.0f, 3.0f
9 ]);
10 
11 assert(r2.evaluate().as!float == [
12     1.0f, 2.0f, 1.0f, 2.0f,
13     3.0f, 4.0f, 3.0f, 4.0f,
14     1.0f, 2.0f, 1.0f, 2.0f,
15     3.0f, 4.0f, 3.0f, 4.0f,
16     1.0f, 2.0f, 1.0f, 2.0f,
17     3.0f, 4.0f, 3.0f, 4.0f
18 ]);

Meta