docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TensorBuilder

    Utility class to build tensors out of some common data types

    Inheritance
    object
    TensorBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Perception.GroundTruth.DataModel
    Assembly: Unity.Perception.Runtime.dll
    Syntax
    public static class TensorBuilder

    Methods

    ToColor32(Tensor)

    Converts from a tensor into a color32 object

    Declaration
    public static Color32 ToColor32(Tensor tensor)
    Parameters
    Type Name Description
    Tensor tensor

    The tensor to convert

    Returns
    Type Description
    Color32

    The converted object

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the object does not match the tensor type

    ToFloat3X3(Tensor)

    Converts from a tensor into a float3x3 object

    Declaration
    public static float3x3 ToFloat3X3(Tensor tensor)
    Parameters
    Type Name Description
    Tensor tensor

    The tensor to convert

    Returns
    Type Description
    float3x3

    The converted object

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the object does not match the tensor type

    ToTensor(float3x3)

    Converts a float3x3 matrix into a tensor

    Declaration
    public static Tensor ToTensor(float3x3 m)
    Parameters
    Type Name Description
    float3x3 m

    The matrix to convert into a tensor

    Returns
    Type Description
    Tensor

    The tensor form of the matrix

    ToTensor(Color32)

    Converts a Color32 object into a tensor

    Declaration
    public static Tensor ToTensor(Color32 c)
    Parameters
    Type Name Description
    Color32 c

    The data to convert into a tensor

    Returns
    Type Description
    Tensor

    The tensor form of the data

    ToTensor(Vector2)

    Converts a Vector2 object into a tensor

    Declaration
    public static Tensor ToTensor(Vector2 v)
    Parameters
    Type Name Description
    Vector2 v

    The data to convert into a tensor

    Returns
    Type Description
    Tensor

    The tensor form of the data

    ToTensor(Vector3)

    Converts a Vector3 object into a tensor

    Declaration
    public static Tensor ToTensor(Vector3 v)
    Parameters
    Type Name Description
    Vector3 v

    The data to convert into a tensor

    Returns
    Type Description
    Tensor

    The tensor form of the data

    ToVector2(Tensor)

    Converts from a tensor into a Vector2 object

    Declaration
    public static Vector2 ToVector2(Tensor tensor)
    Parameters
    Type Name Description
    Tensor tensor

    The tensor to convert

    Returns
    Type Description
    Vector2

    The converted object

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the object does not match the tensor type

    ToVector3(Tensor)

    Converts from a tensor into a Vector3 object

    Declaration
    public static Vector3 ToVector3(Tensor tensor)
    Parameters
    Type Name Description
    Tensor tensor

    The tensor to convert

    Returns
    Type Description
    Vector3

    The converted object

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the object does not match the tensor type

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)