vp_suite.model_blocks.phydnet
- class DecoderSplit(out_channels=64, enc_channels=64)
Bases:
torch.nn.modules.module.Module
This class implements a decoder as used by the PhyDNet introduced in Le Guen and Thome (https://arxiv.org/abs/2003.01460) and implemented in https://github.com/vincent-leguen/PhyDNet. It is similar to the DCGANDecoder introduced in Radford et al. (arxiv.org/abs/1511.06434).
- __init__(out_channels=64, enc_channels=64)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class EncoderSplit(in_channels=64, enc_channels=64)
Bases:
torch.nn.modules.module.Module
This class implements an encoder as used by the PhyDNet introduced in Le Guen and Thome (https://arxiv.org/abs/2003.01460) and implemented in https://github.com/vincent-leguen/PhyDNet. It is similar to the DCGANEncoder introduced in Radford et al. (arxiv.org/abs/1511.06434).
- __init__(in_channels=64, enc_channels=64)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(x)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class K2M(shape)
Bases:
torch.nn.modules.module.Module
This class implements methods to convert convolution kernels to moment matrices. Used by PhyDNet, which is introduced in Le Guen and Thome (https://arxiv.org/abs/2003.01460) and implemented in https://github.com/vincent-leguen/PhyDNet.
Examples
>>> k2m = K2M([5,5]) >>> k = torch.randn(5,5,dtype=torch.float64) >>> m = k2m(k)
- property M
The moment matrix.
- Type
Returns
- __init__(shape)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- dim()
Returns: The kernel dimensionality.
- forward(k)
TODO
- property invM
The inverse moment matrix.
- Type
Returns
- size()
Returns: The kernel size.
- class PhyCell(input_size, input_dim, hidden_dims, n_layers, kernel_size, action_conditional, action_size, device)
Bases:
vp_suite.base.base_model_block.VPModelBlock
This class implements the ‘PhyCell’ component, as introduced in Le Guen and Thome (https://arxiv.org/abs/2003.01460) and implemented in https://github.com/vincent-leguen/PhyDNet.
- CODE_REFERENCE = 'https://github.com/vincent-leguen/PhyDNet'
The code location of the reference implementation.
- MATCHES_REFERENCE: str = 'Not Yet'
A comment indicating whether the implementation in this package matches the reference.
- PAPER_REFERENCE = 'https://arxiv.org/abs/2003.01460'
The publication where this model was introduced first.
- __init__(input_size, input_dim, hidden_dims, n_layers, kernel_size, action_conditional, action_size, device)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(frame, action, first_timestep=False)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class PhyCell_Cell(input_dim, action_conditional, action_size, hidden_dim, kernel_size, bias=True)
Bases:
vp_suite.base.base_model_block.VPModelBlock
This class implements a single Cell of the ‘PhyCell’ component, as introduced in Le Guen and Thome (https://arxiv.org/abs/2003.01460) and implemented in https://github.com/vincent-leguen/PhyDNet.
- CODE_REFERENCE = 'https://github.com/vincent-leguen/PhyDNet'
The code location of the reference implementation.
- MATCHES_REFERENCE: str = 'Not Yet'
A comment indicating whether the implementation in this package matches the reference.
- PAPER_REFERENCE = 'https://arxiv.org/abs/2003.01460'
The publication where this model was introduced first.
- __init__(input_dim, action_conditional, action_size, hidden_dim, kernel_size, bias=True)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(frame, action, hidden)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class SingleStepConvLSTM(input_size, input_dim, hidden_dims, n_layers, kernel_size, action_conditional, action_size, device)
Bases:
torch.nn.modules.module.Module
This class implements a ConvLSTM-Like module used by the PhyDNet introduced in Le Guen and Thome (https://arxiv.org/abs/2003.01460) and implemented in https://github.com/vincent-leguen/PhyDNet. As opposed to a regular ConvLSTM, this module processes each frame in a separate
forward()
call.- __init__(input_size, input_dim, hidden_dims, n_layers, kernel_size, action_conditional, action_size, device)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- forward(frame, action, first_timestep=False)
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- find_divisor_for_group_norm(x)
Find a good divisor for group norm layer initializations, looking for a value that lies close to the square root of the input channel dims.
- Parameters
x (int) – Channel dims.
Returns: The found divisor.
- tensordot(a, b, dim)
TODO Tensordot in PyTorch, see numpy.tensordot?