Network
BaseNetwork
- class BaseNetwork.BaseNetwork(config: namedtuple)[source]
- forward(input_data: Any) Any [source]
Compute a forward pass of the Network.
- Parameters
input_data – Input tensor.
- Returns
Network prediction.
- get_parameters() Dict[str, Any] [source]
Return the current state of Network parameters.
- Returns
Network parameters.
- load_parameters(path: str) None [source]
Load network parameter from path.
- Parameters
path – Path to Network parameters to load.
- nb_parameters() int [source]
Return the number of parameters of the network.
- Returns
Number of parameters.
- numpy_to_tensor(data: ndarray, grad: bool = True) Any [source]
Transform and cast data from numpy to the desired tensor type.
- Parameters
data – Array data to convert.
grad – If True, gradient will record operations on this tensor.
- Returns
Converted tensor.
- predict(data_net: Dict[str, Any]) Dict[str, Any] [source]
Compute a forward pass of the Network.
- Parameters
data_net – Data used by the Network.
- Returns
Data produced by the Network.
- save_parameters(path: str) None [source]
Saves the network parameters to the path location.
- Parameters
path – Path where to save the parameters.
BaseNetworkConfig
- class BaseNetworkConfig.BaseNetworkConfig(network_class: ~typing.Type[~DeepPhysX.Core.Network.BaseNetwork.BaseNetwork] = <class 'DeepPhysX.Core.Network.BaseNetwork.BaseNetwork'>, optimization_class: ~typing.Type[~DeepPhysX.Core.Network.BaseOptimization.BaseOptimization] = <class 'DeepPhysX.Core.Network.BaseOptimization.BaseOptimization'>, data_transformation_class: ~typing.Type[~DeepPhysX.Core.Network.BaseTransformation.BaseTransformation] = <class 'DeepPhysX.Core.Network.BaseTransformation.BaseTransformation'>, network_dir: ~typing.Optional[str] = None, network_name: str = 'Network', network_type: str = 'BaseNetwork', which_network: int = -1, save_each_epoch: bool = False, data_type: str = 'float32', lr: ~typing.Optional[float] = None, require_training_stuff: bool = True, loss: ~typing.Optional[~typing.Any] = None, optimizer: ~typing.Optional[~typing.Any] = None)[source]
- create_data_transformation() BaseTransformation [source]
Create an instance of data_transformation_class with given parameters.
- Returns
BaseTransformation object from data_transformation_class and its parameters.
BaseOptimization
- class BaseOptimization.BaseOptimization(config: namedtuple)[source]
- compute_loss(data_pred: Dict[str, Any], data_opt: Dict[str, Any]) Dict[str, Any] [source]
Compute loss from prediction / ground truth.
- Parameters
data_pred – Tensor produced by the forward pass of the Network.
data_opt – Ground truth tensor to be compared with prediction.
- Returns
Loss value.
DataTransformation
- class BaseTransformation.BaseTransformation(config: namedtuple)[source]
- transform_before_apply(data_pred: Dict[str, Any]) Dict[str, Any] [source]
Apply data operations between loss computation and prediction apply in environment.
- Parameters
data_pred – Data produced by the Network.
- Returns
Transformed data_pred.
- transform_before_loss(data_pred: Dict[str, Any], data_opt: Optional[Dict[str, Any]] = None) Tuple[Dict[str, Any], Optional[Dict[str, Any]]] [source]
Apply data operations between network’s prediction and loss computation.
- Parameters
data_pred – Data produced by the Network.
data_opt – Data used by the Optimizer.
- Returns
Transformed data_pred, data_opt.