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

Function mish

dlib/cuda/cpu_dlib.cpp:1854–1867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1852 // ------------------------------------------------------------------------------------
1853
1854 void mish (
1855 tensor& dest,
1856 const tensor& src
1857 )
1858 {
1859 const auto d = dest.host_write_only();
1860 const auto s = src.host();
1861 for (size_t i = 0; i < src.size(); ++i)
1862 {
1863 const auto e = std::exp(s[i]);
1864 const auto delta = 2*e + e*e + 2;
1865 d[i] = s[i] - 2*s[i]/delta;
1866 }
1867 }
1868
1869 void mish_gradient(
1870 tensor& grad,

Callers 2

test_mishFunction · 0.50
forwardMethod · 0.50

Calls 4

expFunction · 0.85
host_write_onlyMethod · 0.45
hostMethod · 0.45
sizeMethod · 0.45

Tested by 1

test_mishFunction · 0.40