Skip to content

Commit

Permalink
fix duplicated tensor name
Browse files Browse the repository at this point in the history
  • Loading branch information
chraac committed Oct 26, 2024
1 parent 657db64 commit 14f2205
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ggml/src/ggml-qnn/op-config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ void ggml_qnn_op_config_base::add_scalar_param(const std::string &name, const Qn
bool ggml_qnn_op_config_base::add_tensor_param(const std::string &name, const qnn_dimension_array_t &dimensions,
int rank, const uint8_t *data, const Qnn_DataType_t data_type,
QNNBackend device, Qnn_GraphHandle_t graph_handle) {
auto param_tensor = std::make_shared<ggml_qnn_tensor>(ggml_qnn_tensor::PARAMETER, name, dimensions, data_type, rank,
// leave the tensor name empty here
auto param_tensor = std::make_shared<ggml_qnn_tensor>(ggml_qnn_tensor::PARAMETER, "", dimensions, data_type, rank,
device, graph_handle, _qnn_instance);
size_t data_size = ggml_type_size(ggml_datatype_from_qnn_datatype(data_type));
for (int i = 0; i < rank; i++) {
Expand Down
4 changes: 3 additions & 1 deletion ggml/src/ggml-qnn/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class ggml_qnn_tensor {
QNNBackend device, Qnn_GraphHandle_t graph_handle,
std::shared_ptr<qnn_instance> qnn_instance) :
_tensor_name(name), _device(device), _qnn_instance(qnn_instance), _graph_handle(graph_handle) {
QNN_TENSOR_SET_NAME(_qnn_tensor, _tensor_name.c_str());
if (!_tensor_name.empty()) {
QNN_TENSOR_SET_NAME(_qnn_tensor, _tensor_name.c_str());
}
QNN_TENSOR_SET_DIMENSIONS(_qnn_tensor, _dimensions.data());
QNN_TENSOR_SET_DATA_FORMAT(_qnn_tensor, QNN_TENSOR_DATA_FORMAT_FLAT_BUFFER);

Expand Down

0 comments on commit 14f2205

Please sign in to comment.