Class ObservationWriter
Allows sensors to write to both TensorProxy and float arrays/lists.
Namespace: Unity.MLAgents.Sensors
Syntax
public class ObservationWriter : objectProperties
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. |