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

Function prelu

dlib/cuda/cpu_dlib.cpp:1945–1961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1943 // ----------------------------------------------------------------------------------------
1944
1945 void prelu (
1946 tensor& dest,
1947 const tensor& src,
1948 const tensor& param
1949 )
1950 {
1951 const float p = param.host()[0];
1952 const float* s = src.host();
1953 float* d = dest.host();
1954 for (size_t i = 0; i < dest.size(); ++i)
1955 {
1956 if (s[i] > 0)
1957 d[i] = s[i];
1958 else
1959 d[i] = p*s[i];
1960 }
1961 }
1962
1963 void prelu_gradient (
1964 tensor& grad,

Callers 1

forwardMethod · 0.50

Calls 2

hostMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected