MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / get_tensor_configs

Function get_tensor_configs

subprojects/llama.cpp/tests/test-gguf.cpp:108–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106typedef std::pair<enum ggml_type, std::array<int64_t, GGML_MAX_DIMS>> tensor_config_t;
107
108static std::vector<tensor_config_t> get_tensor_configs(std::mt19937 & rng) {
109 std::vector<tensor_config_t> tensor_configs;
110 tensor_configs.reserve(100);
111
112 for (int i = 0; i < 100; ++i) {
113 const enum ggml_type type = ggml_type(rng() % GGML_TYPE_COUNT);
114 if (ggml_type_size(type) == 0) {
115 continue;
116 }
117
118 std::array<int64_t, GGML_MAX_DIMS> shape = {1, 1, 1, 1};
119 shape[0] = (1 + rng() % 10) * ggml_blck_size(type);
120 const int n_dims = 1 + rng() % GGML_MAX_DIMS;
121 for (int i = 1; i < n_dims; ++i) {
122 shape[i] = 1 + rng() % 10;
123 }
124
125 tensor_configs.push_back(std::make_pair(type, shape));
126 }
127
128 return tensor_configs;
129}
130
131static std::vector<std::pair<enum gguf_type, enum gguf_type>> get_kv_types(std::mt19937 rng) {
132 std::vector<std::pair<enum gguf_type, enum gguf_type>> kv_types;

Callers 5

get_handcrafted_fileFunction · 0.85
handcrafted_check_headerFunction · 0.85
handcrafted_check_kvFunction · 0.85

Calls 4

ggml_type_sizeFunction · 0.85
ggml_blck_sizeFunction · 0.85
ggml_typeEnum · 0.70
push_backMethod · 0.45

Tested by

no test coverage detected