\ :py:mod:`clipppy.commands.command` ==================================== .. py:module:: clipppy.commands.command Module Contents --------------- .. py:class:: Command(**kwargs) An abstract base class for commands. Defines an interface that allows manipulating parameters of the command in three distinct ways. Firstly, the *class* object itself provides the defaults. Next, when an instance is created, the constructor takes arbitrary keyword arguments that will be set as *instance* attributes overriding the defaults. Finally, when a class instance is called, any possible parameters that are included in the :python:``**kwargs`` parameter are extracted and set on the instance before execution of the `~Command.forward` method, which should be overridden to provide the actual command implementation. Commands also support "binding" keyword parameters in much the same way as `functools.partial`, through the `boundkwargs` property. The provided keywords are then always included in the `~Command.forward` call, if the forward call has explicit parameters with the same names. .. py:attribute:: boundkwargs :annotation: :dict A dictionary of values to be forwarded to each call of `forward`, if there are exact name matches in its signature. .. py:attribute:: no_call Special value to be used to indicate that instead of calling an object, it should be returned as is. .. py:attribute:: plate_stack :annotation: :Union[Iterable[int], ContextManager] A stack of plates or an iterable of ints. Either one or multiple plates (as returned by `pyro.plate ` or `pyro.plate_stack `) or an iterable of ints that will be converted to a stack of plates (named ``plate_0``, etc. and aligned to ``rightmost_dim = -1``) for batch mock generation. .. py:method:: __call__(self, *args, **kwargs) .. py:method:: __getattribute__(self, name) Return getattr(self, name). .. py:method:: attr_names(self) -> list[str] :property: .. py:method:: forward(self, *args, **kwargs) :abstractmethod: .. py:method:: plate(self) -> pyro.plate :property: .. py:method:: setattr(self, kwargs: dict[str, Any]) .. py:class:: SamplingCommand(**kwargs) An abstract base class for commands. Defines an interface that allows manipulating parameters of the command in three distinct ways. Firstly, the *class* object itself provides the defaults. Next, when an instance is created, the constructor takes arbitrary keyword arguments that will be set as *instance* attributes overriding the defaults. Finally, when a class instance is called, any possible parameters that are included in the :python:``**kwargs`` parameter are extracted and set on the instance before execution of the `~Command.forward` method, which should be overridden to provide the actual command implementation. Commands also support "binding" keyword parameters in much the same way as `functools.partial`, through the `boundkwargs` property. The provided keywords are then always included in the `~Command.forward` call, if the forward call has explicit parameters with the same names. .. py:attribute:: conditioning :annotation: :bool = False Whether to retain any conditioning already applied to the model. If a false value, `pyro.poutine.handlers.uncondition` will be applied to ``model`` before evaluating. .. py:attribute:: initting :annotation: :bool = True Whether to respect ``init`` values in config sites. .. py:attribute:: savename :annotation: :str Filename to save the sample to (or `None` to skip saving). .. py:method:: init(self) :property: .. py:method:: uncondition(self) :property: