Skip to content

Commit dfcff33

Browse files
committed
tests: Fix OPT_STEP_SGD test-backend-ops
1 parent bc97cdc commit dfcff33

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

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

57965796
test_cases.emplace_back(new test_opt_step_adamw(GGML_TYPE_F32, {10, 5, 4, 3}));
5797-
if (test_sgd)
5798-
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
5797+
test_cases.emplace_back(new test_opt_step_sgd(GGML_TYPE_F32, { 10, 5, 4, 3 }));
57995798

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

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

59615956
if (mode == MODE_GRAD) {
5962-
auto test_cases = make_test_cases_eval(sgd);
5957+
auto test_cases = make_test_cases_eval();
59635958
filter_test_cases(test_cases, params_filter);
59645959
size_t n_ok = 0;
59655960
for (auto & test : test_cases) {

0 commit comments

Comments
 (0)