diff options
author | Georgi Gerganov <ggerganov@gmail.com> | 2023-12-21 23:20:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 23:20:49 +0200 |
commit | afefa319f1f59b002dfa0d1ef407a2c74bd9770b (patch) | |
tree | a6923e0a6214293d88957cd11e25943f2c0fb80a /tests/test-backend-ops.cpp | |
parent | 769a7bc85eaa44e3d7eadf39abfeff7bb0b9cc2f (diff) |
ggml : change ggml_scale to take a float instead of tensor (#4573)
* ggml : change ggml_scale to take a float instead of tensor
* ggml : fix CPU implementation
* tests : fix test-grad0
ggml-ci
Diffstat (limited to 'tests/test-backend-ops.cpp')
-rw-r--r-- | tests/test-backend-ops.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test-backend-ops.cpp b/tests/test-backend-ops.cpp index f04b9438..f3df8a8c 100644 --- a/tests/test-backend-ops.cpp +++ b/tests/test-backend-ops.cpp @@ -766,18 +766,19 @@ struct test_bin_bcast : public test_case { struct test_scale : public test_case { const ggml_type type; const std::array<int64_t, 4> ne; + float scale; std::string vars() override { - return VARS_TO_STR2(type, ne); + return VARS_TO_STR3(type, ne, scale); } test_scale(ggml_type type = GGML_TYPE_F32, - std::array<int64_t, 4> ne = {10, 10, 10, 10}) - : type(type), ne(ne) {} + std::array<int64_t, 4> ne = {10, 10, 10, 10}, + float scale = 2.0f) + : type(type), ne(ne), scale(scale) {} ggml_tensor * build_graph(ggml_context * ctx) override { ggml_tensor * a = ggml_new_tensor(ctx, type, 4, ne.data()); - ggml_tensor * scale = ggml_new_tensor_1d(ctx, type, 1); ggml_tensor * out = ggml_scale(ctx, a, scale); return out; } |