niftynet.layer.channel_sparse_convolution module¶

class
ChannelSparseDeconvLayer
(*args, **kwargs)[source]¶ Bases:
niftynet.layer.deconvolution.DeconvLayer
Channel sparse convolutions perform convolutions over a subset of image channels and generate a subset of output channels. This enables spatial dropout without wasted computations

layer_op
(input_tensor, input_mask=None, output_mask=None)[source]¶ Parameters:  input_tensor – image to convolve with kernel
 input_mask – 1Tensor with a binary mask of input channels to use If this is None, all channels are used.
 output_mask – 1Tensor with a binary mask of output channels to generate. If this is None, all channels are used and the number of output channels is set at graphcreation time.
Returns:


class
ChannelSparseConvLayer
(*args, **kwargs)[source]¶ Bases:
niftynet.layer.convolution.ConvLayer
Channel sparse convolutions perform convolutions over a subset of image channels and generate a subset of output channels. This enables spatial dropout without wasted computations.

layer_op
(input_tensor, input_mask, output_mask)[source]¶ Parameters:  input_tensor – image to convolve with kernel
 input_mask – 1Tensor with a binary mask of input channels to use If this is None, all channels are used.
 output_mask – 1Tensor with a binary mask of output channels to generate. If this is None, all channels are used and the number of output channels is set at graphcreation time.
Returns:


class
ChannelSparseBNLayer
(n_dense_channels, *args, **kwargs)[source]¶ Bases:
niftynet.layer.bn.BNLayer
Channel sparse convolutions perform convolutions over a subset of image channels and generate a subset of output channels. This enables spatial dropout without wasted computations

layer_op
(inputs, is_training, mask, use_local_stats=False)[source]¶ Parameters:  inputs – image to normalize. This typically represents a sparse subset of channels from a sparse convolution.
 is_training – boolean that is True during training. When True, the layer uses batch statistics for normalization and records a moving average of means and variances. When False, the layer uses previously computed moving averages for normalization.
 mask – 1Tensor with a binary mask identifying the sparse channels represented in inputs
 use_local_stats –
Returns:


class
ChannelSparseConvolutionalLayer
(n_output_chns, kernel_size=3, stride=1, dilation=1, padding='SAME', with_bias=False, with_bn=True, acti_func=None, w_initializer=None, w_regularizer=None, b_initializer=None, b_regularizer=None, moving_decay=0.9, eps=1e05, name='conv')[source]¶ Bases:
niftynet.layer.base_layer.TrainableLayer
This class defines a composite layer with optional components:
channel sparse convolution > batchwisespatial dropout > batch_norm > activation
The b_initializer and b_regularizer are applied to the ChannelSparseConvLayer, the w_initializer and w_regularizer are applied to the ChannelSparseConvLayer, the batch normalisation layer, and the activation layer (for ‘prelu’)