diff --git a/tf_adapter_2.x/npu_device/core/npu_device.cpp b/tf_adapter_2.x/npu_device/core/npu_device.cpp index ca7c5e425761573098912a7fbfdc950d66eeea9a..be0a990e9c578e4b8d6cb2ffcf3318694260bef8 100644 --- a/tf_adapter_2.x/npu_device/core/npu_device.cpp +++ b/tf_adapter_2.x/npu_device/core/npu_device.cpp @@ -936,7 +936,7 @@ void NpuDevice::TransTfInputs2GeInputs(int num_inputs, TFE_TensorHandle **inputs dims.emplace_back(dim_size); } input.SetTensorDesc(ge::TensorDesc(ge::Shape(dims), ge::FORMAT_ND, ge_type)); - input.SetData(static_cast(tensor->data()), tensor->TotalBytes()); + input.SetData(static_cast(tensor->data()), tensor->TotalBytes(), [](uint8_t *) {}); ge_inputs.emplace_back(input); DLOG() << " input " << i << " ge enum " << ge_type << " tf type " << tensorflow::DataTypeString(tensor->dtype()) << VecToString(dims); diff --git a/tf_adapter_2.x/tests/stub/include/ge/ge_api.h b/tf_adapter_2.x/tests/stub/include/ge/ge_api.h index 79347a9420f2f143bb4433e73589e506e880a406..23a37692d5fe645b201a6107fdfed88c4f495381 100644 --- a/tf_adapter_2.x/tests/stub/include/ge/ge_api.h +++ b/tf_adapter_2.x/tests/stub/include/ge/ge_api.h @@ -93,6 +93,13 @@ class Tensor { return GRAPH_SUCCESS; } + graphStatus SetData(uint8_t *data, size_t size, const Tensor::DeleteFunc &deleter_func) { + data_ = std::unique_ptr(new uint8_t[2], deleter_func); + data_.reset(data); + size_ = size; + return GRAPH_SUCCESS; + } + private: TensorDesc desc_; std::unique_ptr data_;