Class Tensor.Options

java.lang.Object
smile.deep.tensor.Tensor.Options
Enclosing class:
Tensor

public static class Tensor.Options extends Object
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 Details

    • Options

      public Options()
      Constructor with default values for every axis.
  • Method Details

    • dtype

      public Tensor.Options dtype(ScalarType type)
      Sets the data type of the elements stored in the tensor.
      Parameters:
      type - the data type.
      Returns:
      this options object.
    • device

      public Tensor.Options device(Device device)
      Sets a compute device on which a tensor is stored.
      Parameters:
      device - a compute device.
      Returns:
      this options object.
    • layout

      public Tensor.Options layout(Layout layout)
      Sets strided (dense) or sparse tensor.
      Parameters:
      layout - the tensor layout.
      Returns:
      this options object.
    • requireGradients

      public Tensor.Options requireGradients(boolean required)
      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.