Template Function tvm::WithoutAttr(TFunc, const std::string&)

Template Function tvm::WithoutAttr(TFunc, const std::string&)#

Function Documentation#

template<typename TFunc>
inline TFunc tvm::WithoutAttr(TFunc input, const std::string &attr_key)#

Copy the function or module, but removes the specified attribute.

This is also why we make it as a function instead of a member function and why we pass by value in the first argument.

// Recommended way to trigger copy on write
func = WithoutAttr(std::move(func), "key1");
func = WithoutAttr(std::move(func), "key2");

Note

This function performs copy on write optimization for func and module. If we move a uniquely referenced func or module into WithoutAttr, then no additional copy will be performed.

Parameters:
  • input – The thing to annotate (BaseFunc or IRModule)

  • attr_key – The attribute key.

Template Parameters:

TFunc – The corresponding function or module type, including BaseFunc. Shared inputs must register a reflected shallow-copy constructor.

Returns:

The new function or module with removed attribute.