get_context#

ray.train.context.get_context() → TrainContext[source]#

Get or create a singleton training context.

The context is only available within a function passed to Ray Train.

See the TrainContext API reference to see available methods.

Returns:

The TrainContext for this process. Inside a function passed to Ray Tune, returns the Ray Tune context instead.

Return type:

TrainContext