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

Function batch_normalize_conv_gradient

dlib/cuda/cudnn_dlibapi.cpp:660–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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