brainpy.math.random.rand_like

Contents

brainpy.math.random.rand_like#

brainpy.math.random.rand_like(input, *, dtype=None, key=None)[source]#

Similar to rand_like in torch.

Returns a tensor with the same size as input that is filled with random numbers from a uniform distribution on the interval [0, 1).

Parameters:
  • input – the size of input will determine size of the output tensor.

  • dtype – the desired data type of returned Tensor. Default: if None, defaults to the dtype of input.

  • key (Union[int, Array, None]) – the seed or key for the random.

Returns:

The random data.