unstale

pypi / tianshou

tianshou

What changed in tianshou 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-29.

38 breaking14 new APIs and options1 behavior and defaults4 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.2.9 on npm

tianshou 241 changes

Breaking changes 30

  • Compatibility was adjusted to require pandas versions below 3.

    2.0.1release notes

  • Interfaces are more well-defined and usable, parameters are extensively documented, and some parameter names are made more consistent and intuitive.

    2.0.0release notes

  • The revised hierarchy separates on-policy, off-policy, and offline algorithms at the type level and makes inheritance relationships meaningful.

    2.0.0release notes

  • Replaces the former BasePolicy abstraction; instantiate an Algorithm and pass it a Policy.

    2.0.0upgrade guide

  • Renamed to Actor.

    2.0.0upgrade guide

  • Renamed to max_grad_norm for consistency.

    2.0.0upgrade guide

  • Renamed from continuous.Actor.

    2.0.0upgrade guide

  • Renamed from continuous.ActorProb.

    2.0.0upgrade guide

  • Removed as a member and constructor argument from the listed network and module classes.

    2.0.0upgrade guide

  • Renamed to gamma.

    2.0.0upgrade guide

  • Renamed to n_step_return_horizon.

    2.0.0upgrade guide

  • Replaces trainer iterator semantics; manual trainer use should call reset followed by execute_epoch.

    2.0.0upgrade guide

  • Removed from algorithm constructors; schedulers are handled through the factory abstractions.

    2.0.0upgrade guide

  • Training parameters are now passed through this dedicated configuration object instead of directly as keyword arguments.

    2.0.0upgrade guide

  • Renamed from OffpolicyTrainer; trainers now use dedicated configuration objects.

    2.0.0upgrade guide

  • Training parameters are now passed through this dedicated configuration object instead of directly as keyword arguments.

    2.0.0upgrade guide

  • Renamed from OnpolicyTrainer; trainers now use dedicated configuration objects.

    2.0.0upgrade guide

  • Training parameters are now passed through this dedicated configuration object instead of directly as keyword arguments.

    2.0.0upgrade guide

  • Algorithms now require optimizer factories rather than torch.optim.Optimizer instances; the factory creates optimizers internally.

    2.0.0upgrade guide

  • Agents persisted with earlier versions cannot be loaded in v2.

    2.0.0upgrade guide

  • Introduced as the policy abstraction optimized by an Algorithm.

    2.0.0upgrade guide

  • Renamed from reset_buffer in run and reset for clarity.

    2.0.0upgrade guide

  • Replaces run's reset_prior_to_run parameter; run now replicates reset's parameters.

    2.0.0upgrade guide

  • Replaced by TrainingConfig and on-policy/off-policy subclasses with aligned parameter names.

    2.0.0upgrade guide

  • Replaced by set_eps_training and set_eps_inference.

    2.0.0upgrade guide

  • The default changed from True to False, avoiding assumptions that collection-step scores are meaningful for early stopping.

    2.0.0upgrade guide

  • The package formerly named tianshou.policy was renamed to tianshou.algorithm, reflecting the separation between learning algorithms and policies.

    2.0.0upgrade guide

  • Atari helper modules atari_network and atari_wrapper moved into this library package.

    2.0.0upgrade guide

  • Replaces SamplingConfig as the high-level training configuration abstraction.

    2.0.0upgrade guide

  • Replaces the trainer parameter update_per_step with a clearer name.

    2.0.0upgrade guide

New APIs and options 8

  • A separate Algorithm abstraction establishes a clear separation between learning algorithms and policies.

    2.0.0release notes

  • Discrete Q-learning policies accept this parameter to set epsilon for inference separately from training.

    2.0.0upgrade guide

  • Discrete Q-learning policies accept this parameter to set epsilon for training separately from inference.

    2.0.0upgrade guide

  • Adds an option to customize the collector factory.

    2.0.0upgrade guide

  • Factory abstraction for creating learning-rate schedulers through the optimizer factory setup.

    2.0.0upgrade guide

  • Introduced as the trainer specialization for offline learning, with its own configuration class.

    2.0.0upgrade guide

  • A separate Policy abstraction establishes a clear separation between learning algorithms and policies.

    2.0.0release notes

  • Lets an Algorithm directly initiate the learning process.

    2.0.0upgrade guide

Fixes and other changes 3

  • Experiment.run now returns an ExperimentResult with trainer_result set.

    2.0.1release notes

  • Original policy parameters are now restored when line search fails.

    2.0.1release notes

  • Tianshou v2 is compatible with Python 3.12.

    2.0.0upgrade guide

tianshou 116 changes

Breaking changes 8

  • The internal attribute critic1 was renamed to critic.

    1.0.0release notes

  • Support for gym environments is dropped; only Gymnasium environments are supported.

    1.0.0release notes

  • Gymnasium environments are now the only supported environment type.

    1.0.0release notes

  • Several signatures no longer accept **kwargs, including policy constructors.

    1.0.0release notes

  • Trainer functions such as offpolicy_trainer are removed in favor of the OffpolicyTrainer class and its run method.

    1.0.0release notes

  • Use the OffpolicyTrainer class and its run method in place of trainer functions such as offpolicy_trainer.

    1.0.0release notes

  • Python versions below 3.11 are no longer supported.

    1.0.0release notes

  • Training methods return dataclasses instead of dictionaries.

    1.0.0release notes

New APIs and options 6

  • A method computes an action directly from a policy's observation and can be used for unrolling.

    1.0.0release notes

  • BatchPrototypes covers fields needed and returned by methods relying on batches in a backwards-compatible way.

    1.0.0release notes

  • CalQL is supported as part of CQL.

    1.0.0release notes

  • High-level interfaces for experiments are available.

    1.0.0release notes

  • ReplayBuffer supports custom keys.

    1.0.0release notes

  • The multiprocessing context can be set explicitly for SubprocEnvWorker.

    1.0.0release notes

Behavior and default changes 1

  • critic2 no longer needs to be explicitly constructed and passed when it should use the same network as critic.

    1.0.0release notes

Fixes and other changes 1

  • The implementation uses dist.mode instead of inferring loc or argmax from the dist_fn input.

    1.0.0release notes