ConvertToAscendString

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

Header File

#include <graph/operator_reg.h>

Function Usage

A template function. It accepts 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 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.

Constraints

None