if is_layer(layer, "Pooling"):
return MaxPooling2D(padding="same")
if is_layer(layer, "BatchNormalization"):
return BatchNormalization()
if is_layer(layer, "Concatenate"):
return Concatenate()
if is_layer(layer, "Add"):
return Add()
After Change
if is_layer(layer, "Dense"):
return torch.nn.Linear(layer.input_units, layer.units)
if is_layer(layer, "Conv"):
return torch.nn.Conv2d(layer.input_channel,
layer.filters,
layer.kernel_size,
padding=layer.kernel_size / 2)
if is_layer(layer, "Pooling"):
return torch.nn.MaxPool2d(2)
if is_layer(layer, "BatchNormalization"):
return torch.nn.BatchNorm2d(layer.num_features)
if is_layer(layer, "Concatenate"):
return TorchConcatenate()
if is_layer(layer, "Add"):
return TorchAdd()
if is_layer(layer, "Dropout"):
return torch.nn.Dropout2d(layer.rate)
if is_layer(layer, "ReLU"):
return torch.nn.ReLU()
if is_layer(layer, "Softmax"):
return torch.nn.Softmax()
if is_layer(layer, "Flatten"):
return TorchFlatten()