torch_randint | R Documentation |
Randint
torch_randint(
low,
high,
size,
generator = NULL,
dtype = NULL,
layout = NULL,
device = NULL,
requires_grad = FALSE,
memory_format = torch_preserve_format()
)
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. |
generator |
( |
dtype |
( |
layout |
( |
device |
( |
requires_grad |
(bool, optional) If autograd should record operations on the returned tensor. Default: |
memory_format |
memory format for the resulting tensor. |
dtype=NULL, layout=torch.strided, device=NULL, requires_grad=False) -> Tensor
Returns a tensor filled with random integers generated uniformly
between low
(inclusive) and high
(exclusive).
The shape of the tensor is defined by the variable argument size
.
.. note:
With the global dtype default (torch_float32
), this function returns
a tensor with dtype torch_int64
.
if (torch_is_installed()) {
torch_randint(3, 5, list(3))
torch_randint(0, 10, size = list(2, 2))
torch_randint(3, 10, list(2, 2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.