Struct ResetResult<TObs>
- Namespace
- Gym.Observations
- Assembly
- Gym.dll
The first observation of an episode and its diagnostics, (observation, info). Deconstructs like a tuple:
var (obs, info) = env.Reset(seed: 42);.
public readonly record struct ResetResult<TObs> : INDArrayCarrier, IDisposable, IEquatable<ResetResult<TObs>>
Type Parameters
TObsThe observation type, an element of the env's observation space.
- Implements
-
IEquatable<ResetResult<TObs>>
- Inherited Members
- Extension Methods
Remarks
Equality follows StepResult<TObs>'s: exact for array observations, Python's == otherwise.
Reference: gymnasium/core.py (Env.reset).
Constructors
ResetResult(TObs, Info)
The first observation of an episode and its diagnostics, (observation, info). Deconstructs like a tuple:
var (obs, info) = env.Reset(seed: 42);.
public ResetResult(TObs Observation, Info Info)
Parameters
ObservationTObsThe initial observation; owned by the caller.
InfoInfoDiagnostics with Python dict semantics, analogous to a step's; never null from Gym's own envs.
Remarks
Equality follows StepResult<TObs>'s: exact for array observations, Python's == otherwise.
Reference: gymnasium/core.py (Env.reset).
Properties
Info
Diagnostics with Python dict semantics, analogous to a step's; never null from Gym's own envs.
public Info Info { get; init; }
Property Value
Information
0.2's name for Info, kept beside Information so 0.2-style reads compile until 2.0 (DR-78).
[Obsolete("0.2's name: read Info (or deconstruct the info). Removed in 2.0.")]
public Info Information { get; }
Property Value
Observation
The initial observation; owned by the caller.
public TObs Observation { get; init; }
Property Value
- TObs
Methods
Dispose()
Releases the observation's and the info's arrays, as Dispose() does:
using var reset = env.Reset(seed: 0);.
public void Dispose()
Remarks
Footgun: copies share the arrays; dispose once, after their last use.
Equals(ResetResult<TObs>)
Exact equality of the observations and Python equality of the infos (see the remarks).
public bool Equals(ResetResult<TObs> other)
Parameters
otherResetResult<TObs>The other result.
Returns
GetHashCode()
A hash consistent with Equals(ResetResult<TObs>) (an array observation contributes its shape only).
public override int GetHashCode()
Returns
- int
The hash.
Operators
implicit operator TObs(ResetResult<TObs>)
The reset's observation, so 0.2's NDArray obs = env.Reset(); compiles until 2.0 (DR-58); 1.0 code reads
Observation or deconstructs (obs, info).
[Obsolete("Reset returns (observation, info): read .Observation or deconstruct (obs, info); this conversion drops the info. Removed in 2.0 with Gym.Legacy.")]
public static implicit operator TObs(ResetResult<TObs> result)
Parameters
resultResetResult<TObs>The reset's result.
Returns
- TObs
result's observation, the same instance.
Remarks
Footgun: the info is dropped silently (only the obsolete warning says so), and arrays inside it are never disposed (Taxi's reset info holds an int8 action mask). Code using var keeps the whole result and is unaffected.