docs.unity.cn
    Show / Hide Table of Contents

    Class ObservationWriter

    Allows sensors to write to both TensorProxy and float arrays/lists.

    Inheritance
    Object
    ObservationWriter
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.MLAgents.Sensors
    Syntax
    public class ObservationWriter

    Properties

    Item[Int32]

    1D write access at a specified index. Use AddList if possible instead.

    Declaration
    public float this[int index] { set; }
    Parameters
    Type Name Description
    Int32 index

    Index to write to.

    Property Value
    Type Description
    Single

    Item[Int32, Int32, Int32]

    3D write access at the specified height, width, and channel.

    Declaration
    public float this[int h, int w, int ch] { set; }
    Parameters
    Type Name Description
    Int32 h
    Int32 w
    Int32 ch
    Property Value
    Type Description
    Single

    Methods

    Add(Quaternion, Int32)

    Write the Quaternion components.

    Declaration
    public void Add(Quaternion quat, int writeOffset = 0)
    Parameters
    Type Name Description
    Quaternion quat

    The Quaternion to be written.

    Int32 writeOffset

    Optional write offset.

    Add(Vector3, Int32)

    Write the Vector3 components.

    Declaration
    public void Add(Vector3 vec, int writeOffset = 0)
    Parameters
    Type Name Description
    Vector3 vec

    The Vector3 to be written.

    Int32 writeOffset

    Optional write offset.

    Add(Vector4, Int32)

    Write the Vector4 components.

    Declaration
    public void Add(Vector4 vec, int writeOffset = 0)
    Parameters
    Type Name Description
    Vector4 vec

    The Vector4 to be written.

    Int32 writeOffset

    Optional write offset.

    AddList(IList<Single>, Int32)

    Write the list of floats.

    Declaration
    public void AddList(IList<float> data, int writeOffset = 0)
    Parameters
    Type Name Description
    IList<Single> data

    The actual list of floats to write.

    Int32 writeOffset

    Optional write offset to start writing from.

    AddRange(IEnumerable<Single>, Int32)

    Write the range of floats

    Declaration
    [Obsolete("Use AddList() for better performance")]
    public void AddRange(IEnumerable<float> data, int writeOffset = 0)
    Parameters
    Type Name Description
    IEnumerable<Single> data
    Int32 writeOffset

    Optional write offset.

    Extension Methods

    ObservationWriterExtension.WriteTexture(ObservationWriter, Texture2D, Boolean)
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 09 March 2021