add test for ggml_log gradients

This commit is contained in:
xaedes 2023-05-06 17:36:21 +02:00
parent 65d9f7349d
commit 5724628d31
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

View file

@ -462,6 +462,22 @@ int main(int argc, const char ** argv) {
}
}
// log
{
const int nargs = 1;
for (int ndims = 1; ndims <= 2; ++ndims) {
for (int i = 0; i < nargs; ++i) {
x[i] = get_random_tensor(ctx0, ndims, ne, 2.0f*1e-3f, 1.0f);
ggml_set_param(ctx0, x[i]);
}
struct ggml_tensor * f = ggml_sum(ctx0, ggml_log(ctx0, x[0]));
check_gradient("log", ctx0, x, f, ndims, nargs, 1e-3f, INFINITY, 1e-1f);
}
}
// sum
{
const int nargs = 1;