nn_utils_rnn_pack_sequence | R Documentation |
sequences
should be a list of Tensors of size L x *
, where L
is
the length of a sequence and *
is any number of trailing dimensions,
including zero.
nn_utils_rnn_pack_sequence(sequences, enforce_sorted = TRUE)
sequences |
|
enforce_sorted |
(bool, optional): if |
For unsorted sequences, use enforce_sorted = FALSE
. If enforce_sorted
is TRUE
, the sequences should be sorted in the order of decreasing length.
enforce_sorted = TRUE
is only necessary for ONNX export.
a PackedSequence
object
if (torch_is_installed()) {
x <- torch_tensor(c(1, 2, 3), dtype = torch_long())
y <- torch_tensor(c(4, 5), dtype = torch_long())
z <- torch_tensor(c(6), dtype = torch_long())
p <- nn_utils_rnn_pack_sequence(list(x, y, z))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.