6fd2d43bfeb1195e68693a66e767464835e40abf,keras/backend/theano_backend.py,,batch_normalization,#Any#Any#Any#Any#Any#Any#,432
Before Change
use_cudnn = ndim < 5 and (dev.startswith("cuda") or dev.startswith("gpu"))
if use_cudnn:
try:
return theano.sandbox.cuda.dnn.dnn_batch_normalization_test(x, gamma, beta, mean, var,
"spatial", epsilon)
except AttributeError:
pass
return T.nnet.bn.batch_normalization(x, gamma, beta, mean, sqrt(var + epsilon),
mode="high_mem")
After Change
try:
axis = mean.broadcastable.index(False)
if axis != 1:
shuffle_pattern = list(range(ndim))
shuffle_pattern[1] = shuffle_pattern[axis]
shuffle_pattern[axis] = 1
x = x.dimshuffle(shuffle_pattern)
mean = mean.dimshuffle(shuffle_pattern)
var = var.dimshuffle(shuffle_pattern)
beta = beta.dimshuffle(shuffle_pattern)
gamma = gamma.dimshuffle(shuffle_pattern)
normed = theano.sandbox.cuda.dnn.dnn_batch_normalization_test(x, gamma, beta, mean, var,
"spatial", epsilon)
if axis != 1:
normed = normed.dimshuffle(shuffle_pattern)
return normed
except AttributeError:
pass
except ValueError:
pass
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: keras-team/keras
Commit Name: 6fd2d43bfeb1195e68693a66e767464835e40abf
Time: 2016-10-28
Author: alois.gruson@niland.io
File Name: keras/backend/theano_backend.py
Class Name:
Method Name: batch_normalization
Project Name: chainer/chainercv
Commit Name: c988c51e02793d7453ae854cc285ef904c8a535d
Time: 2017-05-06
Author: Hakuyume@users.noreply.github.com
File Name: tests/extensions_tests/detection_tests/test_detection_vis_report.py
Class Name: _RandomDetectionStubLink
Method Name: predict
Project Name: keras-team/keras
Commit Name: 10d7e21efcf04bdb3438a809863a2fe728efe614
Time: 2017-03-12
Author: joshuarchin@gmail.com
File Name: keras/layers/recurrent.py
Class Name: Recurrent
Method Name: call