garage.torch.value_functions.value_function

Base class for all baselines.

class ValueFunction(env_spec, name)

Bases: abc.ABC, torch.nn.Module

Inheritance diagram of garage.torch.value_functions.value_function.ValueFunction

Base class for all baselines.

Parameters
  • env_spec (EnvSpec) – Environment specification.

  • name (str) – Value function name, also the variable scope.

abstract compute_loss(obs, returns)

Compute mean value of loss.

Parameters
  • obs (torch.Tensor) – Observation from the environment with shape \((N \dot [T], O*)\).

  • returns (torch.Tensor) – Acquired returns with shape \((N, )\).

Returns

Calculated negative mean scalar value of

objective (float).

Return type

torch.Tensor