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 f32ebdee2774b16ce6667232f73495abf4c5759b..c0aa246c4bcd1257c0ac3cc030ead65dd79c38c9 100644 --- a/tf_adapter_2.x/npu_device/core/npu_device.cpp +++ b/tf_adapter_2.x/npu_device/core/npu_device.cpp @@ -587,14 +587,15 @@ tensorflow::Status NpuDevice::TransResourceInput2GraphNode( .Attr("_arg_index", int(index)) .Finalize(graph, &arg_substitutes[node])); } else if (arg_is_variable.count(index)) { - NPU_REQUIRES_OK(tensorflow::NodeBuilder(npu::WrapResourceName(arg_resource_handles[index].name()), "VarHandleOp") - .Attr("container", arg_resource_handles[index].container()) - .Attr("shared_name", arg_resource_handles[index].name()) - .Attr("dtype", arg_handle_dtyes[index][0]) - .Attr("shape", arg_handle_shapes[index][0]) - .Attr("_arg_name", node->name()) - .Attr("_arg_index", int(index)) - .Finalize(graph, &arg_substitutes[node])); + NPU_REQUIRES_OK( + tensorflow::NodeBuilder(npu::WrapResourceName(arg_resource_handles[index].name()), "VarHandleOp") + .Attr("container", arg_resource_handles[index].container()) + .Attr("shared_name", arg_resource_handles[index].name()) + .Attr("dtype", arg_handle_dtyes[index][0]) + .Attr("shape", arg_handle_shapes[index][0]) + .Attr("_arg_name", node->name()) + .Attr("_arg_index", int(index)) + .Finalize(graph, &arg_substitutes[node])); } } } @@ -1597,9 +1598,9 @@ void NpuDevice::RunOp(TFE_Context *context, const npu::OpSpec *spec, int num_inp // npu_inputs 指向NPU内存的TFE_TensorHandle** // outputs 指向NPU内存的TFE_TensorHandle** // parser_ndef 打了输入输出描述的ndef,需要优化,后续直接存储ACL的结构体 - // output_shapes 临时变量,算子的输出shape - // spec - // 待运算算子的说明信息,必定包含InputShapes(),InputTypes(),OutputTypes(),不一定包含OutputShapes()(因为有的算子inferShape依赖输入的值(如reshape),输出shape需要使用上面的output_shapes临时变量) + // output_shapes 临时变量,算子的输出shape, + // spec 待运算算子的说明信息,必定包含InputShapes(),InputTypes(),OutputTypes(), + // 不一定包含OutputShapes()(因为有的算子inferShape依赖输入的值(如reshape),输出shape需要使用上面的output_shapes临时变量) /* 从TFE_TensorHandle*获取NpuManagedBuffer: diff --git a/tf_adapter_2.x/npu_device/core/npu_device_register.h b/tf_adapter_2.x/npu_device/core/npu_device_register.h index 6e83824ffae79c8debcdbab3582141802c1d381e..ef5f9f56de2435a29034b96d77ded5cfc0f5da57 100644 --- a/tf_adapter_2.x/npu_device/core/npu_device_register.h +++ b/tf_adapter_2.x/npu_device/core/npu_device_register.h @@ -23,7 +23,7 @@ #include "tensorflow/c/eager/c_api.h" namespace npu { -std::string CreateDevice(TFE_Context *context, const char *device_name, int device_index, +std::string CreateDevice(TFE_Context *context, const char *name, int device_index, const std::map &device_options); void ReleaseDeviceResource();