ConvertToAscendString

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

#include <graph/operator_reg.h>

Function Usage

A template function. It takes a template parameter T and converts it to the AscendString type. It is mainly used to convert strings of different types to those of the AscendString type.

Prototype

1
template<typename T> ge::AscendString ConvertToAscendString(T str)

The following conversions are supported:

  • template<> inline ge::AscendString ConvertToAscendString<const char *>(const char *str)

    Converts strings of the const char * type using the constructor function of the AscendString class.

  • template<> inline ge::AscendString ConvertToAscendString<std::string>(std::string str)

    Converts strings of the std::string type to the const char * type first and then converts it again.

  • template<> inline ge::AscendString ConvertToAscendString<ge::AscendString>(ge::AscendString str)

    Returns strings of the AscendString type directly.

Parameters

Parameter

Input/Output

Description

str

Input

String to be converted.

Returns

String of the AscendString type after conversion.

Restrictions

None