Package smile.deep.tensor
Class Tensor.Options
java.lang.Object
smile.deep.tensor.Tensor.Options
- Enclosing class:
Tensor
A class that encapsulates the construction axes of a tensor.
With construction axis we mean a particular property of a tensor
that can be configured before its construction (and sometimes
changed afterward).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSets a compute device on which a tensor is stored.dtype
(ScalarType type) Sets the data type of the elements stored in the tensor.Sets strided (dense) or sparse tensor.requireGradients
(boolean required) Set true if gradients need to be computed for this tensor.
-
Constructor Details
-
Options
public Options()Constructor with default values for every axis.
-
-
Method Details
-
dtype
Sets the data type of the elements stored in the tensor.- Parameters:
type
- the data type.- Returns:
- this options object.
-
device
Sets a compute device on which a tensor is stored.- Parameters:
device
- a compute device.- Returns:
- this options object.
-
layout
Sets strided (dense) or sparse tensor.- Parameters:
layout
- the tensor layout.- Returns:
- this options object.
-
requireGradients
Set true if gradients need to be computed for this tensor.- Parameters:
required
- the flag indicating if gradients need to be computed for this tensor.- Returns:
- this options object.
-