Storch Tensors

To keep track of the stochastic computation graph, Storchastic returns wrapped torch.Tensor that are subclasses of storch.Tensor. This wrapper contains information that allows Storchastic to analyse the computation graph during inference to properly estimate gradients. Furthermore, storch.Tensor contains plate information that allows for automatic broadcasting with other storch.Tensor objects with different plate information.

class storch.tensor.IndependentTensor(tensor: torch.Tensor, parents: [Tensor], plates: [Plate], tensor_name: str, plate_name: str, weight: Optional[storch.Tensor])[source]

Bases: Tensor

Used to denote independencies on a Tensor. This could for example be the minibatch dimension. The first dimension of the input tensor is taken to be independent and added as a batch dimension to the storch system.

stochastic() bool[source]
Returns

True if this is a stochastic node in the stochastic computation graph, False otherwise.

Return type

bool