OpTilingParseContextBuilder用于构建TilingParseContext。构造出的Context在算子TilingParse计算过程中作为输入,用于获取必要的算子输入输出数据。完成Parser计算后,结果会被写回到上下文中。
OpTilingParseContextBuilder继承关系图如下:
使用步骤如下:
调用OpTilingParseContextBuilder接口,传入相应的输入数据,比如输入的InputTensorDesc、CompiledJson等,最终调用Build()接口构造一个ContextHolder<TilingParseContext>对象。
该类继承自OpContextBuilderBase类,在Build构建ContextHolder对象之前,需要调用OpContextBuilderBase的OpType、OpName、IONum或IOInstanceNum,以及AppendAttr接口,分别设置算子的类型、名称、输入输出个数、以及算子的属性。
1 | #include "base/context_builder/op_tiling_parse_context_builder.h" |
OpTilingParseContextBuilder()
~OpTilingParseContextBuilder() override
OpTilingParseContextBuilder &InputTensorDesc(size_t index, ge::DataType dtype, ge::Format origin_format,
ge::Format storage_format,
const gert::ExpandDimsType &expand_dims_type = {})
OpTilingParseContextBuilder &OutputTensorDesc(size_t index, ge::DataType dtype, ge::Format origin_format,
ge::Format storage_format,
const gert::ExpandDimsType &expand_dims_type = {})
OpTilingParseContextBuilder &CompiledJson(const ge::char_t *compiled_json)
OpTilingParseContextBuilder &CompiledInfo(const void *compile_info)
OpTilingParseContextBuilder &PlatformInfo(const void *platform_info)
ContextHolder<TilingParseContext> Build()