Skip to content

Commit caf6743

Browse files
committed
tests: Fix OPT_STEP_SGD test-backend-ops
1 parent 43a3215 commit caf6743

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ggml/src/ggml.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,9 @@ static const char * GGML_OP_NAME[GGML_OP_COUNT] = {
10061006
"CROSS_ENTROPY_LOSS",
10071007
"CROSS_ENTROPY_LOSS_BACK",
10081008
"OPT_STEP_ADAMW",
1009-
"GLU",
10101009
"OPT_STEP_SGD",
1010+
1011+
"GLU",
10111012
};
10121013

10131014
static_assert(GGML_OP_COUNT == 87, "GGML_OP_COUNT != 87");
@@ -1106,8 +1107,9 @@ static const char * GGML_OP_SYMBOL[GGML_OP_COUNT] = {
11061107
"cross_entropy_loss(x,y)",
11071108
"cross_entropy_loss_back(x,y)",
11081109
"adamw(x)",
1109-
"glu(x)",
11101110
"sgd(x)",
1111+
1112+
"glu(x)",
11111113
};
11121114

11131115
static_assert(GGML_OP_POOL_COUNT == 2, "GGML_OP_POOL_COUNT != 2");

tests/test-backend-ops.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5001,7 +5001,7 @@ static const ggml_type other_types[] = {
50015001
};
50025002

50035003
// Test cases for evaluation: should try to cover edge cases while using small input sizes to keep the runtime low
5004-
static std::vector<std::unique_ptr<test_case>> make_test_cases_eval(bool test_sgd = true) {
5004+
static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
50055005
std::vector<std::unique_ptr<test_case>> test_cases;
50065006
std::default_random_engine rng(0);
50075007

@@ -5793,8 +5793,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval(bool test_sg
57935793
test_cases.emplace_back(new test_cross_entropy_loss_back(GGML_TYPE_F32, {30000, 1, 1, 1}));
57945794

57955795
test_cases.emplace_back(new test_opt_step_adamw(GGML_TYPE_F32, {10, 5, 4, 3}));
5796-
if (test_sgd)
5797-
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
5796+
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
57985797

57995798
#if 0
58005799
// these tests are disabled to save execution time, sbut they can be handy for debugging
@@ -5929,10 +5928,6 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
59295928
}
59305929
};
59315930

5932-
char const* name = ggml_backend_name(backend);
5933-
bool const vulkan = strstr(name, "ulkan");
5934-
bool const sgd = !vulkan;
5935-
59365931
if (mode == MODE_TEST) {
59375932
auto test_cases = make_test_cases_eval();
59385933
filter_test_cases(test_cases, params_filter);
@@ -5958,7 +5953,7 @@ static bool test_backend(ggml_backend_t backend, test_mode mode, const char * op
59585953
}
59595954

59605955
if (mode == MODE_GRAD) {
5961-
auto test_cases = make_test_cases_eval(sgd);
5956+
auto test_cases = make_test_cases_eval();
59625957
filter_test_cases(test_cases, params_filter);
59635958
size_t n_ok = 0;
59645959
for (auto & test : test_cases) {

0 commit comments

Comments
 (0)