Skip to content

Commit 0f2ab83

Browse files
authored
Merge pull request #42 from boscotsang/patch-1
Fix batchnormlayer compatibility to TF12
2 parents 37899b3 + a2613a1 commit 0f2ab83

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tensorlayer/layers.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,9 +1719,14 @@ def _get_variable(name,
17191719
beta = _get_variable('beta',
17201720
params_shape,
17211721
initializer=beta_init)
1722-
gamma = _get_variable('gamma',
1723-
params_shape,
1724-
initializer=gamma_init)
1722+
try: # TF12
1723+
gamma = _get_variable('gamma',
1724+
params_shape,
1725+
initializer=gamma_init())
1726+
except: # TF11
1727+
gamma = _get_variable('gamma',
1728+
params_shape,
1729+
initializer=gamma_init)
17251730

17261731
# trainable=False means : it prevent TF from updating this variable
17271732
# from the gradient, we have to update this from the mean computed

0 commit comments

Comments
 (0)