Class Constant
Represents a constant in a model.
Inherited Members
Namespace: Unity.Sentis.Layers
Syntax
public class Constant
Constructors
Constant()
Initializes and returns an empty Constant
.
Declaration
public Constant()
Constant(String, Tensor)
Initializes and returns a Constant
from a given name and tensor.
Declaration
public Constant(string name, Tensor tensor)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name to use for the constant. |
Tensor | tensor | The tensor to take the shape, dataType and weights of the constant from. |
Fields
dataType
The data type of the constant as a DataType
.
Declaration
public DataType dataType
Field Value
Type | Description |
---|---|
DataType |
length
The number of elements in the constant.
Declaration
public int length
Field Value
Type | Description |
---|---|
Int32 |
name
The name of the constant.
Declaration
public string name
Field Value
Type | Description |
---|---|
String |
offset
The offset of the first element of the constant in the weights
array.
Declaration
public long offset
Field Value
Type | Description |
---|---|
Int64 |
shape
The shape of the constant as a TensorShape
.
Declaration
public TensorShape shape
Field Value
Type | Description |
---|---|
TensorShape |
weights
The elements of the constant as a NativeTensorArray
.
Declaration
public NativeTensorArray weights
Field Value
Type | Description |
---|---|
NativeTensorArray |
Methods
DataSetToTensor()
Creates and returns a CPU Tensor
of the constant.
Declaration
public Tensor DataSetToTensor()
Returns
Type | Description |
---|---|
Tensor |
TensorToDataSet(Tensor)
Initializes the constant with the shape, dataType and weights from a given Tensor
.
Declaration
public void TensorToDataSet(Tensor X)
Parameters
Type | Name | Description |
---|---|---|
Tensor | X |
ToString()
Returns a string that represents the Constant
.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |