add test for ggml_sum_rows gradients
This commit is contained in:
parent
e6186d98a5
commit
80223d98fd
1 changed files with 17 additions and 0 deletions
|
@ -494,6 +494,23 @@ int main(int argc, const char ** argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// sum_rows
|
||||||
|
{
|
||||||
|
const int nargs = 1;
|
||||||
|
|
||||||
|
for (int ndims = 1; ndims <= 4; ++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]);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ggml_tensor * f = ggml_sum(ctx0, ggml_sqr(ctx0, ggml_sum_rows(ctx0, x[0])));
|
||||||
|
|
||||||
|
check_gradient("sum_rows", ctx0, x, f, ndims, nargs, 1e-3f, 1e-2f, INFINITY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// repeat
|
// repeat
|
||||||
{
|
{
|
||||||
int64_t ne2[4];
|
int64_t ne2[4];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue