CreateBoolTensor

Applicability

Product

Supported or Not

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

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.

Constraints

None

Examples

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);