Serialize
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Header File
#include <graph/arg_desc_info.h>
Function Usage
Serializes ArgsFormat into a data stream.
Prototype
1 | static AscendString Serialize(const std::vector<ArgDescInfo> &args_format) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
args_format |
Input |
ArgsFormat information, which consists of multiple ArgDescInfo APIs. |
Returns
Serialization result of ArgsFormat.
An empty string is returned upon a failure.
Constraints
None
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | graphStatus Mc2GenTaskCallback(const gert::ExeResGenerationContext *context, std::vector<std::vector<uint8_t>> &tasks) { .... // Change ArgsFormat of the original AI Core task. auto aicore_task = KernelLaunchInfo::LoadFromData(context, tasks.back()); auto aicore_args_format_str = aicore_task.GetArgsFormat(); auto aicore_args_format = ArgsFormatSerializer::Deserialize(aicore_args_format_str); size_t i = 0UL; for (; i < aicore_args_format.size(); i++) { if (aicore_args_format[i].GetType() == ArgDescType::kIrInput || aicore_args_format[i].GetType() == ArgDescType::kInputInstance) { break; } } aicore_args_format.insert(aicore_args_format.begin() + i, ArgDescInfo::CreateHiddenInput(HiddenInputSubType::kHcom)); aicore_task.SetArgsFormat(ArgsFormatSerializer::Serialize(aicore_args_format).GetString()); tasks.back() = aicore_task.Serialize(); return SUCCESS; } |
Parent topic: ArgsFormatSerializer