class_docstr: Arm(R) Ethos(TM)-U NPU config class
class_docstr_tok: ["Arm","(","R",")","Ethos","(","TM",")","-U","NPU","config","class"]
docstr: Estimate cycles per output element for an NPU operator
  
  Parameters
  ----------
  op_type : str
      The NPU primitive operator
          "ethosu_pooling"
  op_str : str
      The type of NPU operator.
          "MAX"
  ifm_dtype: str
      Datatype of the Input Feature Map tensor (IFM)
  ofm_dtype: str
      Datatype of the Output Feature Map tensor (OFM)
  activation : str
      The activation function to use.
          "NONE" - no activation function.
          "CLIP" - clip the output between clip_min and clip_max.
          "TANH" - tanh activation function.
          "SIGMOID" - sigmoid activation function.
          "LUT" - use a look-up table to perform the activation function.
  
  Returns
  -------
  float
      The cycles per output element
docstr_tok: ["Estimate","cycles","per","output","element","for","an","NPU","operator","Parameters","--","--","--","--","--","op_type",":","str","The","NPU","primitive","operator","``","ethosu_pooling","''","op_str",":","str","The","type","of","NPU","operator",".","``","MAX","''","ifm_dtype",":","str","Datatype","of","the","Input","Feature","Map","tensor","(","IFM",")","ofm_dtype",":","str","Datatype","of","the","Output","Feature","Map","tensor","(","OFM",")","activation",":","str","The","activation","function","to","use",".","``","NONE","''","-","no","activation","function",".","``","CLIP","''","-","clip","the","output","between","clip_min","and","clip_max",".","``","TANH","''","-","tanh","activation","function",".","``","SIGMOID","''","-","sigmoid","activation","function",".","``","LUT","''","-","use","a","look-up","table","to","perform","the","activation","function",".","Returns","--","--","--","-","float","The","cycles","per","output","element"]
code: def _get_output_cycles(
      self,
      op_type: str,
      op_str: str,
      ifm_dtype: str,
      ofm_dtype: str,
      activation: str,
  ) -> float:
      """Estimate cycles per output element for an NPU operator
  
      Parameters
      ----------
      op_type : str
          The NPU primitive operator
              "ethosu_pooling"
      op_str : str
          The type of NPU operator.
              "MAX"
      ifm_dtype: str
          Datatype of the Input Feature Map tensor (IFM)
      ofm_dtype: str
          Datatype of the Output Feature Map tensor (OFM)
      activation : str
          The activation function to use.
              "NONE" - no activation function.
              "CLIP" - clip the output between clip_min and clip_max.
              "TANH" - tanh activation function.
              "SIGMOID" - sigmoid activation function.
              "LUT" - use a look-up table to perform the activation function.
  
      Returns
      -------
      float
          The cycles per output element
      """
      cycles = 0
      bw_limit = 0
      if op_type == "ethosu_pooling" and op_str == "MAX":
          cycles = self._output_cycles[0]
      elif op_type in (
          "ethosu_pooling",
          "ethosu_conv2d",
          "ethosu_depthwise_conv2d",
      ):
          cycles = (
              self._output_cycles[1]
              if ifm_dtype == "int8"
              else self._output_cycles[2]
          )
      elif op_type == "ethosu_binary_elementwise":
          # Binary Bandwidth Limitations
          if ifm_dtype == "int8":
              bw_limit = 0.125 if ofm_dtype == "int8" else 0.75
          elif ifm_dtype == "int16":
              bw_limit = 0.75 if ofm_dtype == "int16" else 1
          else:
              bw_limit = 1.5
  
          if op_str in ("MIN", "MAX"):
              cycles = self._output_cycles[1]
          elif op_str == "MUL":
              cycles = self._output_cycles[2]
          if op_str in ("ADD", "SUB"):
              if ofm_dtype == "int32":
                  cycles = (
                      self._output_cycles[2]
                      if ifm_dtype == "int32"
                      else self._output_cycles[3]
                  )
              else:
                  cycles = self._output_cycles[4]
  
      elif op_type == "ethosu_unary_elementwise":
          # Unary Bandwidth Limitations
          if ifm_dtype == "int16":
              bw_limit = 0.25
          elif ifm_dtype == "int32":
              bw_limit = 1
  
          if op_str == "CLZ":
              cycles = self._output_cycles[1]
          elif op_str in ("SHL", "SHR"):
              cycles = self._output_cycles[2]
          elif op_str in ("LRELU", "ABS"):
              cycles = self._output_cycles[1]
              if ifm_dtype == "int16":
                  bw_limit = 0.5
  
      act_cycles = 0
      if activation == "CLIP":
          act_cycles = self._activation_cycles[0]
      elif activation in ("LUT", "TANH", "SIGMOID"):
          act_cycles = self._activation_cycles[1]
  
      return max((cycles / self._output_units), act_cycles, bw_limit)
  
imports: from typing import Tuple, List, Dict, Optional
  from functools import reduce
  import math
  import numpy
  import tvm
  from .None import BlockConfig
  from .None import StripeConfig
  from .None import Propagator
label_desc: Use image node_id 2 for calling the EthosuDeviceConfig obj's underlying member method code with example usage: obj._get_output_cycles(op_type, op_str, ifm_dtype, ofm_dtype, activation) and returns: max