Shortcuts

framework.context

context

Context

class ding.framework.context.Context(_kept_keys: set = <factory>, total_step: int = 0)[source]
Overview:

Context is an object that pass contextual data between middlewares, whose life cycle is only one training iteration. It is a dict that reflect itself, so you can set any properties as you wish. Note that the initial value of the property must be equal to False.

keep(*keys: str) None[source]
Overview:

Keep this key/keys until next iteration.

renew() Context[source]
Overview:

Renew context from self, add total_step and shift kept properties to the new instance.