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

Function relu_gradient

dlib/cuda/cudnn_dlibapi.cpp:1944–1970  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1942 }
1943
1944 void relu_gradient (
1945 tensor& grad,
1946 const tensor& dest,
1947 const tensor& gradient_input
1948 )
1949 {
1950 DLIB_CASSERT(
1951 have_same_dimensions(dest,gradient_input) == true &&
1952 have_same_dimensions(dest,grad) == true );
1953 if (dest.size() == 0)
1954 return;
1955
1956 const float alpha = 1;
1957 const float beta = is_same_object(grad,gradient_input) ? 0 : 1;
1958 CHECK_CUDNN(cudnnActivationBackward(context(),
1959 relu_activation_descriptor(),
1960 &alpha,
1961 descriptor(dest),
1962 dest.device(),
1963 descriptor(gradient_input),
1964 gradient_input.device(),
1965 descriptor(dest),
1966 dest.device(),
1967 &beta,
1968 descriptor(grad),
1969 grad.device()));
1970 }
1971
1972 // ------------------------------------------------------------------------------------
1973

Callers

nothing calls this directly

Calls 7

descriptorFunction · 0.85
have_same_dimensionsFunction · 0.70
contextFunction · 0.70
is_same_objectFunction · 0.50
sizeMethod · 0.45
deviceMethod · 0.45

Tested by

no test coverage detected