docs.unity3d.com
    Show / Hide Table of Contents

    Class Constant

    Represents a constant in a model.

    Inheritance
    Object
    Constant
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    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
    Overrides
    Object.ToString()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023