Hướng dẫn dùng torch.randint python
Returns a tensor filled with random integers generated uniformly between The shape of the tensor is defined by the variable argument Note With the global dtype default ( low (int, optional) – Lowest integer to be drawn from the distribution. Default: 0. high
(int) – One above the highest integer to be drawn from the distribution. size (tuple) – a tuple defining the shape of the output tensor.
Example: >>> torch.randint(3, 5, (3,)) tensor([4, 3, 4]) >>> torch.randint(10, (2, 2)) tensor([[0, 2], [5, 5]]) >>> torch.randint(3, 10, (2, 2)) tensor([[4, 5], [6, 7]]) |