View

class View(view=(None, -1))[source]

Bases: sphinx.ext.autodoc.importer._MockObject

A module to change a tensor’s view

Parameters:view (tuple, optional) – the new view of the tensor (the first argument can be None, which will be replaced by the current batchsize; also supports a single -1, which specifies a dimension range, which has to be infered during runtime) Default: (None, -1)
forward(input_tensor)[source]

Performs the actual change of view

Parameters:input_tensor (torch.Tensor) – tensor whose view will be changed
Returns:tensor with changed view
Return type:torch.Tensor

Flatten

class Flatten[source]

Bases: torch_layers.view.View

A module to flatten all dimensions despite the batch dimension

forward(input_tensor)

Performs the actual change of view

Parameters:input_tensor (torch.Tensor) – tensor whose view will be changed
Returns:tensor with changed view
Return type:torch.Tensor