简体   繁体   中英

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 eg 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 ..?

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)

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.

批量标准化

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM