deepSIP.architecture¶
-
class
deepSIP.architecture.DropoutCNN(spec_len, kernel=15, filters=8, fc_size=32, drop_rate=0.1)¶ Bases:
torch.nn.modules.module.Modulecore model architecture
4 x (Conv + ReLU + Max Pooling + Dropout) + (Linear + ReLU + Dropout) + Linear
Parameters: - spec_len : int,
number of wavelength bins for pre-processed spectra
- kernel : odd int, optional
convolutional kernel size
- filters : int, optional
number of filters in first convolution layer
- fc_size : int, optional
number of neurons in fully connected layer
- drop_rate : float, optional
dropout probability
Attributes: - conv[1-4] : torch.nn.Sequential
convolution block [1-4]
- fc : torch.nn.Sequential
fully connected block
- out : toch.nn.Sequential
output block
Methods
__call__(self, *input, **kwargs)Call self as a function. add_module(self, name, module)Adds a child module to the current module. apply(self, fn)Applies fnrecursively to every submodule (as returned by.children()) as well as self.buffers(self[, recurse])Returns an iterator over module buffers. children(self)Returns an iterator over immediate children modules. cpu(self)Moves all model parameters and buffers to the CPU. cuda(self[, device])Moves all model parameters and buffers to the GPU. double(self)Casts all floating point parameters and buffers to doubledatatype.eval(self)Sets the module in evaluation mode. extra_repr(self)Set the extra representation of the module float(self)Casts all floating point parameters and buffers to float datatype. forward(self, x)forward pass half(self)Casts all floating point parameters and buffers to halfdatatype.load_state_dict(self, state_dict[, strict])Copies parameters and buffers from state_dictinto this module and its descendants.modules(self)Returns an iterator over all modules in the network. named_buffers(self[, prefix, recurse])Returns an iterator over module buffers, yielding both the name of the buffer as well as the buffer itself. named_children(self)Returns an iterator over immediate children modules, yielding both the name of the module as well as the module itself. named_modules(self[, memo, prefix])Returns an iterator over all modules in the network, yielding both the name of the module as well as the module itself. named_parameters(self[, prefix, recurse])Returns an iterator over module parameters, yielding both the name of the parameter as well as the parameter itself. parameters(self[, recurse])Returns an iterator over module parameters. register_backward_hook(self, hook)Registers a backward hook on the module. register_buffer(self, name, tensor)Adds a persistent buffer to the module. register_forward_hook(self, hook)Registers a forward hook on the module. register_forward_pre_hook(self, hook)Registers a forward pre-hook on the module. register_parameter(self, name, param)Adds a parameter to the module. state_dict(self[, destination, prefix, …])Returns a dictionary containing a whole state of the module. to(self, *args, **kwargs)Moves and/or casts the parameters and buffers. train(self[, mode])Sets the module in training mode. type(self, dst_type)Casts all parameters and buffers to dst_type.zero_grad(self)Sets gradients of all model parameters to zero. share_memory -
forward(self, x)¶ forward pass
Parameters: - x : torch.tensor of shape (batch size, 1, number of wavelength bins)
inputs to the network