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: str)¶ Returns an implementation of a function.
-
static
get_attribute
(classname: str, attr_name: str)¶
-
static
get_method
(classname: str, method_name: str)¶
-
static
get_ufunc
(ufunc_method: str = None)¶ Returns the implementation for NumPy universal functions.
-
static
getop
(classname: str, optype: str, otherclass: str = None)¶ Returns an implementation of an operator.
-
static
-
dace.frontend.common.op_repository.
replaces
(func: Callable[[...], Tuple[str]], name: str)¶ Registers a replacement sub-SDFG generator for a function. :param func: A function that receives an SDFG, SDFGState, and the original function
arguments, returning a tuple of array names to connect to the outputs.Parameters: name – Full name (pydoc-compliant, including package) of function to replace.
-
dace.frontend.common.op_repository.
replaces_attribute
(func: Callable[[...], Tuple[str]], classname: str, attr_name: str)¶ Registers a replacement sub-SDFG generator for object attributes. :param func: A function that receives an SDFG, SDFGState, and the original
function arguments, returning a tuple of array names to connect to the outputs.Parameters: - classname – Full name (pydoc-compliant, including package) of the object class.
- attr_name – Name of the attribute.
-
dace.frontend.common.op_repository.
replaces_method
(func: Callable[[...], Tuple[str]], classname: str, method_name: str)¶ Registers a replacement sub-SDFG generator for methods on objects. :param func: A function that receives an SDFG, SDFGState, and the original
function arguments, returning a tuple of array names to connect to the outputs.Parameters: - classname – Full name (pydoc-compliant, including package) of the object class.
- method_name – Name of the invoked method.
-
dace.frontend.common.op_repository.
replaces_operator
(func: Callable[[Any, Any, str, str], Tuple[str]], classname: str, optype: str, otherclass: str = None)¶ Registers a replacement sub-SDFG generator for an operator. :param func: A function that receives an SDFG, SDFGState, and the two operand array names,
returning a tuple of array names to connect to the outputs.Parameters: - classname – The name of the class to implement the operator for (extends dace.Data).
- optype – The type (as string) of the operator to replace (extends ast.operator).
- otherclass – Optional argument defining operators for a second class that differs from the first.
-
dace.frontend.common.op_repository.
replaces_ufunc
(func: Callable[[...], Tuple[str]], name: str)¶ Registers a replacement sub-SDFG generator for NumPy universal functions and methods.
Parameters: - func – 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 – ‘ufunc’ for NumPy ufunc or ufunc method name for replacing the NumPy ufunc methods.