Deeploy.Targets.PULPOpen.TypeCheckers.PULPRQAddChecker

class Deeploy.Targets.PULPOpen.TypeCheckers.PULPRQAddChecker(input_types: Sequence[Type[Pointer]], output_types: Sequence[Type[Pointer]])

Bases: SignPropTypeChecker

Methods

__init__(input_types: Sequence[Type[Pointer]], output_types: Sequence[Type[Pointer]])

Generate a type checking rule

Parameters:
  • input_types (Sequence[Type[Pointer]]) – Ordered sequence of Deeploy-types that should be assigned to the operator’s Python-typed input tensor

  • output_types (Sequence[Type[Pointer]]) – Ordered sequence of Deeploy-types that should be assigned to the operator’s Python-typed input tensor

__init__(input_types, output_types)

Generate a type checking rule

annotateDict(ctxt, node, operatorRepresentation)

Store the inferred typing information into the rule's type dict

checkOutputType(inputs, operatorRepresentation)

TypeCheck method to-be-implemented.

typeCheck(ctxt, node, operatorRepresentation)

DONT OVERRIDE - Uses other NodeTypeChecker methods to implement full type inference on a single node

typeCheckNodeInputs(ctxt, node)

DONT OVERRIDE - Type checks all input nodes to confirm they either already are assigned the correct type or their type can be statically upcast to the rule's input types

typeInferGlobalCtxt(ctxt, node)

typeInferOutput(ctxt, node, ...)

DONT OVERRIDE - Annotates each VariableBuffer in the NetworkContext corresponding to an output of the operator with this rule's output types.

Attributes

typeDict

Stores the type assignment of the input and output tensors, mapping them to the names defined by the NodeParser

checkOutputType(inputs: List[VariableBuffer], operatorRepresentation: Dict[str, str | Any]) bool

TypeCheck method to-be-implemented. Returns whether the type checking rule is met or not

Parameters:
  • inputs (List[VariableBuffer]) – Ordered list of operator inputs to be used for inferring the output type

  • operatorRepresentation (OperatorRepresentation) – NodeParser’s operatorRepresentation

Returns:

True if output type can be assigned as defined in output_types

Return type:

bool

annotateDict(ctxt: NetworkContext, node: Node, operatorRepresentation: Dict[str, str | Any])

Store the inferred typing information into the rule’s type dict

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • node (gs.Node) – Operator whose inputs and outputs should be considered

  • operatorRepresentation (OperatorRepresentation) – The NodeParser’s operatorRepresentation

typeCheck(ctxt: NetworkContext, node: Node, operatorRepresentation: Dict[str, str | Any]) Tuple[NetworkContext, bool]

DONT OVERRIDE - Uses other NodeTypeChecker methods to implement full type inference on a single node

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • node (gs.Node) – Node that should be used for type inference

  • operatorRepresentation (OperatorRepresentation) – The NodeParser’s operatorRepresentation

Returns:

Updated NetworkContext and whether type inference was successful with this rule.

Return type:

Tuple[NetworkContext, bool]

typeCheckNodeInputs(ctxt: NetworkContext, node: Node) bool

DONT OVERRIDE - Type checks all input nodes to confirm they either already are assigned the correct type or their type can be statically upcast to the rule’s input types

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • node (gs.Node) – Node whose inputs should be analyzes

Returns:

Whether the input’s types match the rule’s requirements

Return type:

bool

typeInferOutput(ctxt: NetworkContext, node: Node, operatorRepresentation: Dict[str, str | Any]) NetworkContext

DONT OVERRIDE - Annotates each VariableBuffer in the NetworkContext corresponding to an output of the operator with this rule’s output types.

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • node (gs.Node) – Node whose outputs should be annotated

  • operatorRepresentation (OperatorRepresentation) – NodeParser’s operatorRepresentation

Returns:

Updated NetworkContext

Return type:

NetworkContext

typeDict: Dict[str, Type[Pointer]]

Stores the type assignment of the input and output tensors, mapping them to the names defined by the NodeParser

Type:

Dict[str, Type[Pointer]]