dace.frontend.common package
Submodules
dace.frontend.common.op_repository module
- class dace.frontend.common.op_repository.Replacements
Bases:
object
A management singleton for functions that replace existing function calls with either an SDFG subgraph. Used in the Python frontend to replace functions such as numpy.ndarray and operators such as Array.__add__.
- static get(name)
Returns an implementation of a function.
- static get_attribute(class_or_name, attr_name)
- static get_method(class_or_name, method_name)
- static get_ufunc(ufunc_method=None)
Returns the implementation for NumPy universal functions.
- static getop(class_or_name, optype, otherclass=None)
Returns an implementation of an operator.
- dace.frontend.common.op_repository.replaces(func, name)
Registers a replacement sub-SDFG generator for a function.
- Parameters:
func (
Callable
[...
,Tuple
[str
]]) – A function that receives an SDFG, SDFGState, and the original function arguments, returning a tuple of array names to connect to the outputs.name (
str
) – Full name (pydoc-compliant, including package) of function to replace.
- dace.frontend.common.op_repository.replaces_attribute(func, classname, attr_name)
Registers a replacement sub-SDFG generator for object attributes.
- Parameters:
func (
Callable
[...
,Tuple
[str
]]) – A function that receives an SDFG, SDFGState, and the original function arguments, returning a tuple of array names to connect to the outputs.classname (
str
) – Full name (pydoc-compliant, including package) of the object class.attr_name (
str
) – Name of the attribute.
- dace.frontend.common.op_repository.replaces_method(func, classname, method_name)
Registers a replacement sub-SDFG generator for methods on objects.
- Parameters:
func (
Callable
[...
,Tuple
[str
]]) – A function that receives an SDFG, SDFGState, and the original function arguments, returning a tuple of array names to connect to the outputs.classname (
str
) – Full name (pydoc-compliant, including package) of the object class.method_name (
str
) – Name of the invoked method.
- dace.frontend.common.op_repository.replaces_operator(func, classname, optype, otherclass=None)
Registers a replacement sub-SDFG generator for an operator.
- Parameters:
func (
Callable
[[Any
,Any
,str
,str
],Tuple
[str
]]) – A function that receives an SDFG, SDFGState, and the two operand array names, returning a tuple of array names to connect to the outputs.classname (
str
) – The name of the class to implement the operator for (extends dace.Data).optype (
str
) – The type (as string) of the operator to replace (extends ast.operator).otherclass (
Optional
[str
]) – Optional argument defining operators for a second class that differs from the first.
- dace.frontend.common.op_repository.replaces_ufunc(func, name)
Registers a replacement sub-SDFG generator for NumPy universal functions and methods.
- Parameters:
func (
Callable
[...
,Tuple
[str
]]) – A function that receives a ProgramVisitor, AST call node, SDFG, SDFGState, ufunc name, and the original function positional and keyword arguments, returning a tuple of array names to connect to the outputs.name (
str
) – ‘ufunc’ for NumPy ufunc or ufunc method name for replacing the NumPy ufunc methods.