MCPcopy Create free account
hub / github.com/davisking/dlib / batch_normalize_conv_gradient

Function batch_normalize_conv_gradient

dlib/cuda/cudnn_dlibapi.cpp:658–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656 }
657
658 void batch_normalize_conv_gradient(
659 const double eps,
660 const tensor& gradient_input,
661 const tensor& means,
662 const tensor& invstds,
663 const tensor& src,
664 const tensor& gamma,
665 tensor& src_grad,
666 tensor& gamma_grad,
667 tensor& beta_grad
668 )
669 {
670 DLIB_CASSERT(src.k() == (long)means.size());
671 DLIB_CASSERT(src.k() == (long)invstds.size());
672 DLIB_CASSERT(src.k() == (long)gamma.size());
673 DLIB_CASSERT(src.k() == (long)gamma_grad.size());
674 DLIB_CASSERT(src.k() == (long)beta_grad.size());
675 DLIB_CASSERT(have_same_dimensions(gradient_input, src));
676 DLIB_CASSERT(have_same_dimensions(gradient_input, src_grad));
677 DLIB_CASSERT(eps > 0);
678
679 const float in_scale = 1;
680 const float out_scale = 1;
681 const float in_scale_params = 1;
682 const float out_scale_params = 0;
683
684 CHECK_CUDNN(cudnnBatchNormalizationBackward(
685 context(),
686 CUDNN_BATCHNORM_SPATIAL,
687 &in_scale,
688 &out_scale,
689 &in_scale_params,
690 &out_scale_params,
691 descriptor(src),
692 src.device(),
693 descriptor(gradient_input),
694 gradient_input.device(),
695 descriptor(src_grad),
696 src_grad.device(),
697 descriptor(gamma),
698 gamma.device(),
699 gamma_grad.device(),
700 beta_grad.device(),
701 eps,
702 means.device(),
703 invstds.device()));
704 }
705
706 // ------------------------------------------------------------------------------------
707 // ------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 6

descriptorFunction · 0.85
have_same_dimensionsFunction · 0.70
contextFunction · 0.70
kMethod · 0.45
sizeMethod · 0.45
deviceMethod · 0.45

Tested by

no test coverage detected