successfully test cpy backward
This commit is contained in:
parent
0ea8201c86
commit
b2bd8222da
1 changed files with 17 additions and 0 deletions
|
@ -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
|
// rope
|
||||||
{
|
{
|
||||||
const int nargs = 1;
|
const int nargs = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue