Class Metadata
An env's metadata dict: an Info with the keys Gym reads spelled as they are in Python
("render_modes", "render_fps"), plus typed accessors for them. Iteration order, equality and
repr are a dict's, so {'render_modes': ['human', 'rgb_array'], 'render_fps': 50} prints and compares
as in Python.
public class Metadata : Info, IDictionary<string, object?>, ICollection<KeyValuePair<string, object?>>, IReadOnlyDictionary<string, object?>, IReadOnlyCollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
- Inheritance
-
Metadata
- Implements
- Inherited Members
- Extension Methods
Remarks
Store Python lists as List<T> and Python ints as long, the forms the rest of Gym.NET and the parity suite read back as Python's; the typed accessors also accept any string sequence and any number.
Constructors
Metadata()
An empty metadata dict, Python's {} (an env's default is {"render_modes": []}, see Env<TObs, TAct>).
public Metadata()
Metadata(IEnumerable<KeyValuePair<string, object?>>)
A metadata dict holding entries in their order.
public Metadata(IEnumerable<KeyValuePair<string, object?>> entries)
Parameters
entriesIEnumerable<KeyValuePair<string, object>>The entries.
Exceptions
- ArgumentNullException
Thrown when
entriesor one of its keys is null.
Fields
RenderFpsKey
The key of the frame rate human rendering and video recording use.
public const string RenderFpsKey = "render_fps"
Field Value
RenderModesKey
The key of the supported render modes, a list of strings.
public const string RenderModesKey = "render_modes"
Field Value
Properties
RenderFps
metadata["render_fps"] as a number, or null when the key is missing or holds
None. Gymnasium stores an int (50) or a float; both read as a double through
Python's float(), which is how pygame.time.Clock.tick takes it. Setting it stores the
double.
public double? RenderFps { get; set; }
Property Value
Exceptions
- TypeError
Thrown by the getter when the stored value is not a number (Python's
float()message).- ValueError
Thrown by the getter for a string that is not a float literal.
RenderModes
metadata["render_modes"] as strings, or null when the key is missing or holds
None. Setting it stores a List<T> (Python's list) under the key, in place if the key exists.
public IReadOnlyList<string>? RenderModes { get; set; }
Property Value
Exceptions
- InvalidCastException
Thrown by the getter when the stored value is not a sequence of strings.
Methods
CreateEmpty()
Creates an empty instance of this info's own type for Copy() and DeepCopy(), so copying a Metadata yields a Metadata. Subclasses with other constructors override it.
protected override Info CreateEmpty()
Returns
- Info
An empty info of the same type.