class_docstr: If ``prelu`` has the same leakage factor across all channels, it will be converted to ``leaky_relu``.
class_docstr_tok: ["If","``","prelu","``","has","the","same","leakage","factor","across","all","channels",",","it","will","be","converted","to","``","leaky_relu","``","."]
code: def _prelu_to_lrelu_block(self, block):
      for op in list(block.operations):
          for b in op.blocks:
              self._prelu_to_lrelu_block(b)
          if len(op.blocks) > 0:
              # This op can't be prelu.
              continue
  
          if op.op_type == "prelu":
              alpha_val = op.alpha.val
              common_leakage_factor = True
              for c in range(1, op.alpha.val.shape[0]):
                  if alpha_val[c] != alpha_val[0]:
                      common_leakage_factor = False
                      break
              if common_leakage_factor:
                  lrelu_out = mb.leaky_relu(
                      x=op.x,
                      alpha=alpha_val[0],
                      name=op.outputs[0].name,
                      before_op=op,
                  )
                  op.enclosing_block.replace_uses_of_var_after_op(
                      anchor_op=op,
                      old_var=op.outputs[0],
                      new_var=lrelu_out,
                  )
                  block.remove_ops([op])
  
imports: import numpy
  from coremltools.converters.mil.experimental.passes.generic_pass_infrastructure import fuse_all_blocks
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import get_new_symbol
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import _check_child_op_type, _check_var_scalar_value, _check_var_scalar_value_in_interval, block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 2 for calling the prelu_to_lrelu obj's underlying member method code with example usage: obj._prelu_to_lrelu_block(block) without return types