Attr

Function

Registers operator attribute parameters.

If a parameter to be set is not involved in computation on the kernel, you can register the parameter as an operator attribute parameter.

Prototype

1
OpAttrDef &Attr(const char *name)

Parameters

Parameter

Input/Output

Description

name

Input

Operator attribute name

Returns

Operator attribute definition. For details about OpAttrDef, see OpAttrDef.

Restrictions

The Attr attribute name cannot be the same as the following Python keywords or built-in variable names. Otherwise, an undefined error occurs.

  • Common Python keywords

    and, as, assert, break, class, continue, def, del, elif, else, except, finally, for, from, global, if, import, in, is, lambda, not, or, pass, raise, return, try, while, with, yield, False, None, True, nonlocal, and arg

  • Built-in variable names

    __inputs__, __outputs__, __attrs__, options, bisheng, bisheng_path, tikcpp_path, impl_mode, custom_compile_options, custom_all_compile_options, soc_version, soc_short, custom_compile_options_soc, custom_all_compile_options_soc, origin_func_name, ascendc_src_dir_ex, ascendc_src_dir, ascendc_src_file, src, op_type, code_channel, op_info, compile_op, get_code_channel, result, isinstance, attr, get_current_build_config, _build_args, get_dtype_fmt_options, shutil, os, get_kernel_source, ascendc_api_version_header_path, ascendc_api_version_file, ascendc_api_version, re.