# NOT RUN {
if (torch_is_installed()) {
weights = torch_tensor(c(0, 10, 3, 0), dtype=torch_float()) # create a tensor of weights
torch_multinomial(weights, 2)
torch_multinomial(weights, 4, replacement=TRUE)
}
# }
Run the code above in your browser using DataLab