matchzoo.modules.dense_net

DenseNet module.

Module Contents

class matchzoo.modules.dense_net.DenseBlock(in_channels, growth_rate: int = 20, kernel_size: tuple = (2, 2), layers_per_dense_block: int = 3)

Bases: torch.nn.Module

Dense block of DenseNet.

forward(self, x)

Forward.

classmethod _make_conv_block(cls, in_channels: int, out_channels: int, kernel_size: tuple)

Make conv block.

class matchzoo.modules.dense_net.DenseNet(in_channels, nb_dense_blocks: int = 3, layers_per_dense_block: int = 3, growth_rate: int = 10, transition_scale_down_ratio: float = 0.5, conv_kernel_size: tuple = (2, 2), pool_kernel_size: tuple = (2, 2))

Bases: torch.nn.Module

DenseNet module.

Parameters:
  • in_channels – Feature size of input.
  • nb_dense_blocks – The number of blocks in densenet.
  • layers_per_dense_block – The number of convolution layers in dense block.
  • growth_rate – The filter size of each convolution layer in dense block.
  • transition_scale_down_ratio – The channel scale down ratio of the convolution layer in transition block.
  • conv_kernel_size – The kernel size of convolution layer in dense block.
  • pool_kernel_size – The kernel size of pooling layer in transition block.
out_channels :int

out_channels getter.

forward(self, x)

Forward.

classmethod _make_transition_block(cls, in_channels: int, transition_scale_down_ratio: float, pool_kernel_size: tuple)