CreateBoolTensor

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Header File/Library File

  • Header file: #include <ge/es_graph_builder.h>
  • Library files: libeager_style_graph_builder_base.so and libeager_style_graph_builder_base_static.a

Function Usage

Creates a tensor of the bool data type and tensor shape.

Prototype

std::unique_ptr<Tensor> CreateBoolTensor(const std::vector<bool> &value, const std::vector<int64_t> &dims, Format format = FORMAT_ND)

Parameters

Parameter

Input/Output

Description

value

Input

Tensor data vector.

dims

Input

Tensor dimension vector.

format

Input

Tensor format. The default value is FORMAT_ND.

Returns

Parameter

Type

Description

-

std::unique_ptr<Tensor>

Smart pointer to the created tensor. If the operation fails, nullptr is returned.

Restrictions

None

Example

1
2
3
4
EsGraphBuilder builder("graph_name");
std::vector<bool> data = {true, false, true, false};
std::vector<int64_t> dims = {4};
auto tensor = builder.CreateBoolTensor(data,dims);