EMCqMRI.core.models.inference.resnet module

class EMCqMRI.core.models.inference.resnet.BasicBlock(in_layer, out_layer, stride=1, downsample=None, use_bias=True)[source]

Bases: torch.nn.modules.module.Module

Initializes internal Module state, shared by both nn.Module and ScriptModule.

expansion = 1
forward(x)[source]

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.

training: bool
class EMCqMRI.core.models.inference.resnet.Resnet(config_object)[source]

Bases: core.base.base_inference_model.InferenceModel, torch.nn.modules.module.Module

Class Implementing the ResNet model. .. method:: - setOpts

inputs: a Dict containing the key and value for a new configuration setting

- forward

inputs: signal (measured signal); outputs: Estimated parameters

forward(inputs)[source]

Abstract function that defines the forward pass of the inference model. It supports conventional and Deep Learning methods. For iterative methods, the steps must be implemented within this function.

Need subclass to implement different logics, like MLE, ResNet, RIM, etc.

Parameters

inputs ([list]) – list of torch.Tensors, containing one or more inputs. If one of the inputs is an image, it must have shape [B, N, X, Y, …], where B is the batch size, N is the number of channels and X,Y,… are the image dimensions. If one of the inputs are scalar parameters, it must have shape [B, N, X], where B is the batch size, N is the number of channels and X the number of parameters.

Raises

NotImplementedError – When the subclass does not override this method.

Returns

The subclass implementation should return the parameter estimates. If estimates are images, they should have shape [B, C, X, Y, …], where B is the batch size, C is the number of parameters and X, Y,… are the image dimensions. If estimates are scalars, they should have shape [B, X], where B is the batch size and X are parameters.

Return type

([torch.Tensor])

training: bool
EMCqMRI.core.models.inference.resnet.custom_batch_norm(input, channels, with_mean)[source]