def __call__(self, nn, train_history): with open(self.out_file+'_layers', 'w') as f: f.write("## Layer information") f.write("\n") layers_contain_conv2d = is_conv2d(list(nn.layers_.values())) if not layers_contain_conv2d or (nn.verbose < 2): layer_info = self._get_layer_info_plain(nn) legend = None else: layer_info, legend = self._get_layer_info_conv(nn) f.write(layer_info) if legend is not None: file.write(legend) f.write(" \n")
def test_is_conv2d_layer(self, nn, cnn, is_conv2d): assert is_conv2d(nn.layers_['input']) is False assert is_conv2d(cnn.layers_['pool2']) is False assert is_conv2d(cnn.layers_['conv1']) is True
def test_is_conv2d_net_true(self, cnn, is_conv2d): assert is_conv2d(cnn.layers_.values()) is True
def test_is_conv2d_net_false(self, nn, is_conv2d): assert is_conv2d(nn.layers_.values()) is False
def test_is_conv2d_layer(self, nn, cnn, is_conv2d): assert is_conv2d(nn.layers_["input"]) is False assert is_conv2d(cnn.layers_["pool2"]) is False assert is_conv2d(cnn.layers_["conv1"]) is True