successfully test cpy backward

This commit is contained in:
xaedes 2023-04-26 20:14:52 +02:00
parent 0ea8201c86
commit b2bd8222da
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

View file

@ -453,6 +453,23 @@ int main(int argc, const char ** argv) {
}
}
// cpy
{
const int nargs = 2;
for (int ndims = 1; ndims <= 2; ++ndims) {
for (int i = 0; i < nargs; ++i) {
x[i] = get_random_tensor(ctx0, ndims, ne, -1.0f, 1.0f);
ggml_set_param(ctx0, x[i]);
}
// x[1] is overwritten by x[0], so the gradients don't propagate to x[1]
struct ggml_tensor * f = ggml_sum(ctx0, ggml_cpy(ctx0, x[0], x[1]));
check_gradient("cpy", ctx0, x, f, ndims, nargs, 1e-3f, 1e-3f, INFINITY);
}
}
// rope
{
const int nargs = 1;