import grain.testing; import grain.utility; import numir; import mir.ndslice; auto f = Linear!(float, HostStorage)(2, 3); auto x = uniform!float(2, 2).slice.variable(true); auto y = f(x); auto gy = uniform!float(y.shape.castArray!size_t).slice.variable; gradCheckChain!f(x, gy, 1e-3, 5e-2, 5e-2);
linear operator