TensorFlow.NET
TensorFlow.NET copied to clipboard
How to use BatchNormalization with tf.keras
Hello, I'm trying to translate a Python Unet architecture into Tensorflow.NET using tf.keras but I don't find how to transpose this piece of Python code into C# :
def conv2d_block(input_tensor, n_filters, kernel_size=3, batchnorm=True):
# first layer
x = Conv2D(filters=n_filters, kernel_size=(kernel_size, kernel_size), kernel_initializer="he_normal",
padding="same")(input_tensor)
if batchnorm:
x = BatchNormalization()(x)
x = Activation("relu")(x)
# second layer
x = Conv2D(filters=n_filters, kernel_size=(kernel_size, kernel_size), kernel_initializer="he_normal",
padding="same")(x)
if batchnorm:
x = BatchNormalization()(x)
x = Activation("relu")(x)
return x
In particular I don't understand how to use BatchNormalization in C#.
Can you help me ?
tf.layers.batch_normalization has not been tested yet.
@JulietteV It's available in TensorFlow.Keras v0.2.1