Deeploy.Targets.Generic.Layers.RQGEMMLayer

class Deeploy.Targets.Generic.Layers.RQGEMMLayer(maps: List[NodeMapper])

Bases: GEMMLayer

Methods

__init__(maps: List[NodeMapper])

__init__(maps)

bind(ctxt)

Attempt to bind the mapper; discard mapper if binding does not work

broadcast(ctxt[, default_channels_first])

Broadcasts the operator's shapes and updates the NetworkContext

codeTransform(ctxt[, verbose])

Apply CodeTransformations to associated mapper's binder

computeOps()

Returns the number of operations (1 MAC = 2 Ops) of this operator

computeShapes(inputShapes, outputShapes, ...)

Takes input and output shapes from the graph-representation and broadcasts them to a predefined layout

discardCurrentMapper()

Discard the current Mapper

generate(ctxt)

Invoke mapper's generate method

parse(ctxt, default_channels_first)

Iterate through all possible mappers and elect the first one that work

resetDiscardedMappers()

Reset all discarded mappers

typeCheck(ctxt)

Invokes the mapper's typeCheck method

Attributes

maps

All potential mappings of an ONNX Layer

mapper

The currently elected NodeMapper to represent this layer

discardedMappers

Set of all NodeMappers which cannot be used to represent this layer

node

The represented operator

computeShapes(inputShapes: List[Shape], outputShapes: Shape, operatorRepresentation, channels_first) Tuple[Shape, Shape]

Takes input and output shapes from the graph-representation and broadcasts them to a predefined layout

Parameters:
  • inputShapes (Shape) – Graph-level input shape

  • outputShapes (Shape) – Graph-level output shapes

  • operatorRepresentation (OperatorRepresentation) – The node’s operatorRepresentation

  • channels_first (bool) – Whether this operator’s data layout is in CxHxW (true) or HxWxC (false) layout

Returns:

Returns broadcasted shapes

Return type:

Tuple[Shape, Shape]

computeOps()

Returns the number of operations (1 MAC = 2 Ops) of this operator

bind(ctxt: NetworkContext) Tuple[NetworkContext, bool]

Attempt to bind the mapper; discard mapper if binding does not work

Parameters:

ctxt (NetworkContext) – Current NetworkContext

Returns:

Updated NetworkContext and boolean to indicate success or failure

Return type:

Tuple[NetworkContext, bool]

broadcast(ctxt: NetworkContext, default_channels_first: bool = True) NetworkContext

Broadcasts the operator’s shapes and updates the NetworkContext

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • default_channels_first (bool) – Whether the default layout if channels-first or not

Returns:

Updated NetworkContext

Return type:

(NetworkContext)

Raises:
  • KeyError – Raises a KeyError if any tensor required is not found in the NetworkContext

  • RuntimeError – Raises a RuntimeError if any tensor’s shape could not be broadcast to the target shape

codeTransform(ctxt: NetworkContext, verbose: CodeGenVerbosity = CodeGenVerbosity(tilingProfiling=None)) NetworkContext

Apply CodeTransformations to associated mapper’s binder

Parameters:
Returns:

Updated NetworkContext

Return type:

Tuple[NetworkContext, bool]

discardCurrentMapper()

Discard the current Mapper

generate(ctxt: NetworkContext) Tuple[NetworkContext, List[str]]

Invoke mapper’s generate method

Parameters:

ctxt (NetworkContext) – Current NetworkContext

Returns:

Updated NetworkContext and flag to indicate success

Return type:

Tuple[NetworkContext, List[str]]

parse(ctxt: NetworkContext, default_channels_first: bool) Tuple[NetworkContext, bool]

Iterate through all possible mappers and elect the first one that work

Parameters:
  • ctxt (NetworkContext) – Current NetworkContext

  • default_channels_first (bool) – Whether the default layout if channels-first or not

Returns:

Updated NetworkContext and boolean to indicate success or failure

Return type:

Tuple[NetworkContext, bool]

resetDiscardedMappers()

Reset all discarded mappers

typeCheck(ctxt: NetworkContext) Tuple[NetworkContext, bool]

Invokes the mapper’s typeCheck method

Parameters:

ctxt (NetworkContext) – Current NetworkContext

Returns:

Updated NetworkContext and boolean to indicate success or failure

Return type:

Tuple[NetworkContext, bool]

mapper: NodeMapper

The currently elected NodeMapper to represent this layer

Type:

NodeMapper

discardedMappers: Set[NodeMapper]

Set of all NodeMappers which cannot be used to represent this layer

Type:

Set[NodeMapper]

node: gs.Node

The represented operator

Type:

gs.Node

maps

All potential mappings of an ONNX Layer

Type:

List[NodeMapper]