MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / test_backend

Function test_backend

external/ggml/tests/test-opt.cpp:842–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842static std::pair<int, int> test_backend(
843 ggml_backend_sched_t backend_sched, ggml_backend_t backend, enum ggml_opt_optimizer_type optim) {
844 int npass = 0;
845 int ntest = 0;
846
847 for (bool shuffle : {false, true}) {
848 std::pair<int, int> partial = test_dataset(optim, backend_sched, backend, shuffle);
849 npass += partial.first;
850 ntest += partial.second;
851 }
852 {
853 std::pair<int, int> partial = test_grad(optim, backend_sched, backend);
854 npass += partial.first;
855 ntest += partial.second;
856 }
857 for (bool high_level : {false, true}){
858 for (bool shuffle : {false, true}) {
859 if (!high_level && shuffle) {
860 continue;
861 }
862
863 std::pair<int, int> partial = test_forward_backward(optim, backend_sched, backend, high_level, shuffle);
864 npass += partial.first;
865 ntest += partial.second;
866 }
867 }
868 {
869 std::pair<int, int> partial = test_epoch_vs_fit(optim, backend_sched, backend);
870 npass += partial.first;
871 ntest += partial.second;
872 }
873 for (bool high_level : {false, true}){
874 std::pair<int, int> partial = test_idata_split(optim, backend_sched, backend, high_level);
875 npass += partial.first;
876 ntest += partial.second;
877 }
878 bool const adamw = optim == GGML_OPT_OPTIMIZER_TYPE_ADAMW;
879 if (adamw) {
880 for (int32_t nbatch_physical : { 2, 1 }) {
881 for (enum ggml_opt_loss_type loss_type : { GGML_OPT_LOSS_TYPE_SUM, GGML_OPT_LOSS_TYPE_MEAN }) {
882 std::pair<int, int> partial =
883 test_gradient_accumulation(optim, backend_sched, backend, nbatch_physical, loss_type);
884 npass += partial.first;
885 ntest += partial.second;
886 }
887 }
888 }
889 {
890 std::pair<int, int> partial = test_regression(optim, backend_sched, backend);
891 npass += partial.first;
892 ntest += partial.second;
893 }
894
895 return std::make_pair(npass, ntest);
896}
897
898
899int main(void) {

Callers 1

mainFunction · 0.70

Calls 7

test_datasetFunction · 0.85
test_gradFunction · 0.85
test_forward_backwardFunction · 0.85
test_epoch_vs_fitFunction · 0.85
test_idata_splitFunction · 0.85
test_regressionFunction · 0.85

Tested by

no test coverage detected