---
title: npu_onnx_graph_op
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/TensorFlowCommercial/latest/migration/tfmigr1/tfmigr1_tfadapi_0073.html
sourcePath: /source/zh/TensorFlowCommercial/900/migration/tfmigr1/tfmigr1_tfadapi_0073.html
indexId: 5e307b1b2b86a55555ef5fcab28018141d66307dd7a938833bd56dda27f165e479
---
# npu_onnx_graph_op

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | ☓ |
| Atlas 推理系列产品 | ☓ |
| Atlas 训练系列产品 | √ |


#### 功能说明

以算子形式加载ONNX模型，将指定路径中onnx模型通过TensorFlow的框架执行在AI处理器。


#### 函数原型

```
def npu_onnx_graph_op(inputs, tout, model_path, name=None)
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| inputs | 输入 | ONNX模型的输入，类型为tensor。 |
| tout | 输入 | ONNX模型的输出类型，如tf.float32。 |
| model\_path | 输入 | ONNX模型所在路径及文件名，例如/test/test.onnx，类型string。 |
| name | 输入 | 指定该算子在图上的名称，类型string。 |


#### 返回值

算子输出列表。


#### 调用示例

```
from npu_bridge.estimator.npu_ops import npu_onnx_graph_op

input = tf.placeholder(dtype=tf.float32, shape=(1, 1, 5, 5), name="conv_input")
output = npu_onnx_graph_op([input], [tf.float32], model_path="conv2d.onnx", name="conv2d")
```
