[Solved] How to give beta and gamma in tf.contrib.layers.batch_norm

I’m trying to use normalization layer given by tensorflow. In that function, there is a field to specify whether we are using beta or gamma values.

center: If True, subtract beta. If False, beta is ignored.

scale: If True, multiply by gamma. If False, gamma is not used. When the next layer is linear (also e.g. nn.relu), this can be disabled since the scaling can be done by the next layer.

But there is nowhere to input beta and gamma values into the function.

I need to know how can I input values for beta and gamma..?

Enquirer: Ramesh-X

||

Solution #1:

The link you provided has specified the function as tf.contrib.layers.batch_norm(*args, **kwargs).

Looks like you should be able to pass beta and gamma as keyword arguments or **kwargs like this:

tf.contrib.layers.batch_norm(beta=value, gamma=value)
Respondent: Shubham Vasaikar

Solution #2:

Beta and gamma are the learnable parameters of the batch normalization layer.

As you can see from the image below, these parameters are used to scale and shift the normalized values. The value you can pass to the batch_norm method, are the init value of these parameters.

batch normalization

Respondent: nessuno

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.