MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / get_tensor_configs

Function get_tensor_configs

smallthinker/tests/test-gguf.cpp:104–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

reserveMethod · 0.80
ggml_typeEnum · 0.70
ggml_type_sizeFunction · 0.50
ggml_blck_sizeFunction · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected