store grain.autograd.BackProp object in returned variables from forward function
type-erased version of backward function used in grain.autograd.BackProp object
auto f = View!(float, 3, 2, HostStorage)([3, -1]); auto x = iota(3, 4, 5).as!float.slice.variable; auto y = f.forward(x); assert(y.sliced == iota(3, 20)); auto hgy = uniform!float(3, 20).slice.variable; auto hgx = f.backward(hgy); assert(hgy.sliced.view(3, 4, 5) == hgx.sliced); // gradCheck(f, x, hgy); version (grain_cuda) { auto df = View!(float, 3, 2, DeviceStorage)([3, -1]); auto dy = df.forward(x.to!DeviceStorage); assert(dy.to!HostStorage.sliced == iota(3, 20)); auto dgx = df.backward(hgy.to!DeviceStorage); assert(dgx.to!HostStorage.sliced.view(3, 4, 5) == hgx.sliced); }