Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tf_extract_opts

Tensor extract options


Description

Tensor extract options

Usage

tf_extract_opts(
  style = getOption("tensorflow.extract.style"),
  ...,
  one_based = getOption("tensorflow.extract.one_based", TRUE),
  inclusive_stop = getOption("tensorflow.extract.inclusive_stop", TRUE),
  disallow_out_of_bounds = getOption("tensorflow.extract.dissallow_out_of_bounds",
    TRUE),
  warn_tensors_passed_asis = getOption("tensorflow.extract.warn_tensors_passed_asis",
    TRUE),
  warn_negatives_pythonic = getOption("tensorflow.extract.warn_negatives_pythonic",
    TRUE)
)

Arguments

style

one of NULL (the default) "R" or "python". If supplied, this overrides all other options. "python" is equivalent to all the other arguments being FALSE. "R" is equivalent to warn_tensors_passed_asis and warn_negatives_pythonic set to FALSE

...

ignored

one_based

TRUE or FALSE, if one-based indexing should be used

inclusive_stop

TRUE or FALSE, if slices like start:stop should be inclusive of stop

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 [ that tensors are passed as-is, with no R to python translation

warn_negatives_pythonic

TRUE or FALSE, whether to emit a warning the first time a negative number is supplied to [ about the non-standard (python-style) interpretation

Value

an object with class "tf_extract_opts", suitable for passing to [.tensorflow.tensor()

Examples

## Not run: 
x <- tf$constant(1:10)

opts <-  tf_extract_opts("R")
x[1, options = opts]

# or for more fine-grained control
opts <- tf_extract_opts(
    one_based = FALSE,
    warn_tensors_passed_asis = FALSE,
    warn_negatives_pythonic = FALSE
)
x[0:2, options = opts]

## End(Not run)

tensorflow

R Interface to 'TensorFlow'

v2.4.0
Apache License 2.0
Authors
Daniel Falbel [ctb, cph, cre], JJ Allaire [aut, cph], RStudio [cph, fnd], Yuan Tang [aut, cph] (<https://orcid.org/0000-0001-5243-233X>), Dirk Eddelbuettel [ctb, cph], Nick Golding [ctb, cph], Tomasz Kalinowski [ctb, cph], Google Inc. [ctb, cph] (Examples and Tutorials)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.