as.vector.torch_tensor: Convert 'torch_tensor' to a vector

View source: R/as-vector.R

as.vector.torch_tensorR Documentation

Convert torch_tensor to a vector

Description

as.vector.torch_tensor attempts to coerce a torch_tensor into a vector of mode mode (the default is to coerce to whichever vector mode is most convenient): if the result is atomic all attributes are removed.

Usage

## S3 method for class 'torch_tensor'
as.vector(x, mode = "any")

Arguments

x

(torch_tensor) A torch tensor

mode

(character) A character string with one of possible vector modes: "any", "list", "expression" or other basic types like "character", "integer" etc.

Value

A vector of desired type. All attributes are removed from the result if it is of an atomic mode, but not in general for a list result.

See Also

base::as.vector


krzjoa/torchts documentation built on June 24, 2022, 5:30 a.m.