提交 2ddda965 authored 作者: Frederic Bastien's avatar Frederic Bastien

small fix found while reviewing.

上级 ef487eed
...@@ -2574,7 +2574,7 @@ def dnn_batch_normalization_train(inputs, gamma, beta, mode='per-activation', ...@@ -2574,7 +2574,7 @@ def dnn_batch_normalization_train(inputs, gamma, beta, mode='per-activation',
if epsilon < 1e-5: if epsilon < 1e-5:
raise ValueError("epsilon must be at least 1e-5, got %f" % epsilon) raise ValueError("epsilon must be at least 1e-5, got %f" % epsilon)
running_averages = (running_var is not None and running_var is not None) running_averages = (running_mean is not None and running_var is not None)
if ndim < 4: if ndim < 4:
inputs = theano.tensor.shape_padright(inputs, 4 - ndim) inputs = theano.tensor.shape_padright(inputs, 4 - ndim)
......
...@@ -1439,7 +1439,8 @@ def test_dnn_batchnorm_train(): ...@@ -1439,7 +1439,8 @@ def test_dnn_batchnorm_train():
mode=mode_with_gpu) mode=mode_with_gpu)
f_ref = theano.function([x, scale, bias, running_mean, running_var, dy], f_ref = theano.function([x, scale, bias, running_mean, running_var, dy],
[out_ref, x_mean_ref, x_invstd_ref, [out_ref, x_mean_ref, x_invstd_ref,
out_running_mean_ref, out_running_var_ref] + grads_ref) out_running_mean_ref, out_running_var_ref] + grads_ref,
mode=mode_without_gpu)
# check if the abstract Ops have been replaced # check if the abstract Ops have been replaced
assert any([isinstance(n.op, dnn.GpuDnnBatchNorm) for n assert any([isinstance(n.op, dnn.GpuDnnBatchNorm) for n
in f_abstract.maker.fgraph.toposort()]) in f_abstract.maker.fgraph.toposort()])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论