February 2018
Intermediate to advanced
262 pages
6h 59m
English
One good way to learn how a particular network works is to look at the source code. PyTorch has a very clean implementation and most of the time is easily readable. Let's look at the DenseLayer implementation:
class _DenseLayer(nn.Sequential): def __init__(self, num_input_features, growth_rate, bn_size, drop_rate): super(_DenseLayer, self).__init__() self.add_module('norm.1', nn.BatchNorm2d(num_input_features)), self.add_module('relu.1', nn.ReLU(inplace=True)), self.add_module('conv.1', nn.Conv2d(num_input_features, bn_size * growth_rate, kernel_size=1, stride=1, bias=False)), self.add_module('norm.2', nn.BatchNorm2d(bn_size * growth_rate)), self.add_module('relu.2', nn.ReLU(inplace=True)), self.add_module('conv.2', nn.Conv2d(bn_size ...Read now
Unlock full access