[unit test] init all tensor by one function
This commit is contained in:
parent
30b40006cc
commit
c46b4deea9
1 changed files with 4 additions and 13 deletions
|
@ -80,11 +80,11 @@ static void ggml_qnn_log_internal(ggml_log_level level, const char * file, const
|
||||||
|
|
||||||
static const char * get_qnn_backend_name(int n_backend_type) {
|
static const char * get_qnn_backend_name(int n_backend_type) {
|
||||||
switch (n_backend_type) {
|
switch (n_backend_type) {
|
||||||
case 0:
|
case QNN_BACKEND_CPU:
|
||||||
return "QNN-CPU";
|
return "QNN-CPU";
|
||||||
case 1:
|
case QNN_BACKEND_GPU:
|
||||||
return "QNN-GPU";
|
return "QNN-GPU";
|
||||||
case 2:
|
case QNN_BACKEND_NPU:
|
||||||
return "QNN-NPU";
|
return "QNN-NPU";
|
||||||
case 3:
|
case 3:
|
||||||
return "ggml";
|
return "ggml";
|
||||||
|
@ -494,16 +494,7 @@ static int qnn_op_ut(int num_threads, int n_backend_type, int n_ggml_op_type) {
|
||||||
gf = ggml_new_graph(ctx);
|
gf = ggml_new_graph(ctx);
|
||||||
ggml_build_forward_expand(gf, dst);
|
ggml_build_forward_expand(gf, dst);
|
||||||
|
|
||||||
if (n_backend_type != QNN_BACKEND_GGML) {
|
initialize_tensors(ctx);
|
||||||
initialize_tensors(ctx);
|
|
||||||
} else {
|
|
||||||
if (qtype == GGML_TYPE_F32) {
|
|
||||||
ggml_set_f32(src0, 2.f);
|
|
||||||
} else {
|
|
||||||
initialize_tensors(ctx);
|
|
||||||
}
|
|
||||||
ggml_set_f32(src1, 3.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
ggml_graph_compute_helper(backend, gf, work_buffer, num_threads, nullptr, nullptr);
|
ggml_graph_compute_helper(backend, gf, work_buffer, num_threads, nullptr, nullptr);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue