struct ggml_tensor * b,
struct ggml_tensor * ids);
- GGML_API struct ggml_tensor * ggml_add1(
+ GGML_DEPRECATED(GGML_API struct ggml_tensor * ggml_add1(
struct ggml_context * ctx,
struct ggml_tensor * a,
- struct ggml_tensor * b);
+ struct ggml_tensor * b),
+ "use ggml_add instead");
- GGML_API struct ggml_tensor * ggml_add1_inplace(
+ GGML_DEPRECATED(GGML_API struct ggml_tensor * ggml_add1_inplace(
struct ggml_context * ctx,
struct ggml_tensor * a,
- struct ggml_tensor * b);
+ struct ggml_tensor * b),
+ "use ggml_add_inplace instead");
// dst = a
// view(dst, nb1, nb2, nb3, offset) += b
}
};
-// GGML_OP_ADD1
-struct test_add1 : public test_case {
- const ggml_type type;
- const std::array<int64_t, 4> ne;
-
- std::string vars() override {
- return VARS_TO_STR2(type, ne);
- }
-
- test_add1(ggml_type type = GGML_TYPE_F32,
- std::array<int64_t, 4> ne = {10, 5, 4, 3})
- : type(type), ne(ne) {}
-
- ggml_tensor * build_graph(ggml_context * ctx) override {
- ggml_tensor * a = ggml_new_tensor(ctx, type, 4, ne.data());
- ggml_set_param(a);
- ggml_set_name(a, "a");
-
- ggml_tensor * b = ggml_new_tensor_1d(ctx, type, 1);
- // ggml_set_param(b); // TODO: implement
- ggml_set_name(b, "b");
-
- ggml_tensor * out = ggml_add1(ctx, a, b);
- ggml_set_name(out, "out");
-
- return out;
- }
-
- float grad_eps() override {
- return 0.1f * ne[0]*ne[1]*ne[2]*ne[3];
- }
-};
-
// GGML_OP_SCALE
struct test_scale : public test_case {
const ggml_type type;
test_cases.emplace_back(new test_bin_bcast(ggml_add, GGML_TYPE_F32, {16, 5, 4, 3}, {2, 2, 2, 2}, 8));
test_cases.emplace_back(new test_bin_bcast(ggml_add, GGML_TYPE_F32, {16, 5, 4, 3}, {1, 1, 1, 1}, 16));
- test_cases.emplace_back(new test_add1());
- test_cases.emplace_back(new test_add1(GGML_TYPE_F32, {1024, 1024, 1, 1}));
test_cases.emplace_back(new test_scale());
test_cases.emplace_back(new test_scale(GGML_TYPE_F32, {10, 10, 10, 10}, 2.0f, 1.0f));
test_cases.emplace_back(new test_scale(GGML_TYPE_F32, {10, 10, 10, 10}, 2.0f, 1.0f, true)); // inplace test