class 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).

  • 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 – the seed or key for the random.


The random data.