torch_extract_opts {rTorch} | R Documentation |
Tensor extract options
Description
Tensor extract options
Usage
torch_extract_opts(
style = getOption("torch.extract.style"),
...,
one_based = getOption("torch.extract.one_based", TRUE),
inclusive_stop = getOption("torch.extract.inclusive_stop", TRUE),
disallow_out_of_bounds = getOption("torch.extract.dissallow_out_of_bounds", TRUE),
warn_tensors_passed_asis = getOption("torch.extract.warn_tensors_passed_asis", TRUE),
warn_negatives_pythonic = getOption("torch.extract.warn_negatives_pythonic", TRUE)
)
Arguments
style |
one of |
... |
ignored |
one_based |
TRUE or FALSE, if one-based indexing should be used |
inclusive_stop |
TRUE or FALSE, if slices like |
disallow_out_of_bounds |
TRUE or FALSE, whether checks are performed on the slicing index to ensure it is within bounds. |
warn_tensors_passed_asis |
TRUE or FALSE, whether to emit a warning the
first time a tensor is supplied to |
warn_negatives_pythonic |
TRUE or FALSE, whether to emit
a warning the first time a negative number is supplied to |
Value
an object with class "torch_extract_opts", suitable for passing to
[.torch.tensor()
Examples
## Not run:
x <- torch$arange(1L, 10L)
opts <- torch_extract_opts("R")
x[1, options = opts]
# or for more fine-grained control
opts <- torch_extract_opts(
one_based = FALSE,
warn_tensors_passed_asis = FALSE,
warn_negatives_pythonic = FALSE
)
x[0:2, options = opts]
## End(Not run)