---
title: CreateTensorBase
description: "用来创建TensorBase对象，并根据传入参数不同，调用不同的构造函数。"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/msadg/mxvisionug_0421.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/msadg/mxvisionug_0421.html
indexId: 110e742a9a0fa857177656144ce1ca7501dd1cb8cc22bfe8b8c7fcccd430397a102
---
# CreateTensorBase

#### 函数功能

用来创建TensorBase对象，并根据传入参数不同，调用不同的构造函数。


#### 函数原型

```
template<typename... Param>
static APP_ERROR CreateTensorBase(TensorBase &tensor, Param... params);
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| tensor | 输出 | TensorBase对象，用于接收构造的TensorBase对象。 |
| params | 输入 | 用于构造TensorBase的参数，具体参数可参考构造函数。 |


#### 返回参数说明

| 数据结构 | 说明 |
| --- | --- |
| APP\_ERROR | 程序执行返回的错误码，请参考APP\_ERROR说明。 |
