oneflow.repeat

oneflow.repeat(input, sizes)Tensor

This operator repeat the input tensor to a larger size along the specified dimensions.

Parameters
  • input (oneflow.Tensor) – the input Tensor.

  • sizes (flow.Shape or List) – The number of times to repeat this tensor along each dimension.

Returns

The result Tensor.

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> import numpy as np
>>> np_arr = np.random.randn(5, 3, 6, 9).astype(np.float32)
>>> input = flow.Tensor(np_arr)
>>> out = input.repeat(1, 1, 2, 2)
>>> out.shape
oneflow.Size([5, 3, 12, 18])
>>> out = input.repeat(2, 1, 1, 2, 2)
>>> out.shape
oneflow.Size([2, 5, 3, 12, 18])