Coverage Control Library
Loading...
Searching...
No Matches
CNN Class Reference

Implements an architecture consisting of a multi-layer CNN followed by an MLP, according to parameters specified in the input config. More...

+ Inheritance diagram for CNN:

Public Member Functions

 __init__ (self, dict config)
 
torch.Tensor forward (self, torch.Tensor x)
 Forward pass through the network.
 
None load_cpp_model (self, str model_path)
 Loads a model saved in cpp jit format.
 
None load_model (self, str model_path)
 Loads a model saved in pytorch format.
 
- Public Member Functions inherited from CNNConfigParser
None parse (self, dict config)
 Parse the configuration for the CNN model.
 

Public Attributes

 cnn_backbone = CNNBackBone(self.config)
 
 mlp
 
 linear = torch.nn.Linear(self.latent_size, self.output_dim)
 
- Public Attributes inherited from CNNConfigParser
 config = None
 
 input_dim = None
 
 output_dim = None
 
 num_layers = None
 
 latent_size = None
 
 kernel_size = None
 
 image_size = None
 

Detailed Description

Implements an architecture consisting of a multi-layer CNN followed by an MLP, according to parameters specified in the input config.

Definition at line 38 of file cnn.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
dict config )

Reimplemented from CNNConfigParser.

Definition at line 40 of file cnn.py.

Member Function Documentation

◆ forward()

torch.Tensor forward ( self,
torch.Tensor x )

Forward pass through the network.

Parameters
xInput tensor
Returns
Output tensor

Definition at line 64 of file cnn.py.

◆ load_cpp_model()

None load_cpp_model ( self,
str model_path )

Loads a model saved in cpp jit format.

Definition at line 74 of file cnn.py.

◆ load_model()

None load_model ( self,
str model_path )

Loads a model saved in pytorch format.

Definition at line 81 of file cnn.py.

Member Data Documentation

◆ cnn_backbone

cnn_backbone = CNNBackBone(self.config)

Definition at line 44 of file cnn.py.

◆ linear

linear = torch.nn.Linear(self.latent_size, self.output_dim)

Definition at line 53 of file cnn.py.

◆ mlp

mlp
Initial value:
= MLP(
[
self.latent_size,
2 * self.latent_size,
2 * self.latent_size,
self.latent_size,
]
)

Definition at line 45 of file cnn.py.