class_docstr: For general quantized operators, in Core ML, we represent them as
  ``dequantize -> the floating-point version of this operator -> quantize``,
  because mathematically it is the floating-point tensor rather than
  its quantized integer representation that gets operated upon.
  
  For some quantized operators that do not involve floating-point arithmetic,
  however, it is unnecessary to prepend ``dequantize`` and append ``quantize``.
  Examples are:
  
  * reshape
class_docstr_tok: ["For","general","quantized","operators",",","in","Core","ML",",","we","represent","them","as","``","dequantize","-",">","the","floating-point","version","of","this","operator","-",">","quantize","``",",","because","mathematically","it","is","the","floating-point","tensor","rather","than","its","quantized","integer","representation","that","gets","operated","upon",".","For","some","quantized","operators","that","do","not","involve","floating-point","arithmetic",",","however",",","it","is","unnecessary","to","prepend","``","dequantize","``","and","append","``","quantize","``",".","Examples","are",":","*","reshape"]
code: def try_to_transform(
      self, dequantize: Operation, op: Operation, quantize: Operation
  ) -> bool:
      block: Block = op.enclosing_block
  
      if not block.try_replace_uses_of_var_after_op(
          anchor_op=quantize,
          old_var=quantize.outputs[0],
          new_var=self.build_int_op(dequantize, op, quantize),
      ):
          return False
  
      # remove op and quantize here, but not dequantize, since:
      # * all uses of op and quantize has been replaced with the canonicalized one
      # * dequantize may feed to multiple ops, which are not replaced
      #   (if not, then pass dead_code_elimination will eliminate it)
      block.remove_ops([op, quantize])
  
      return True
  
imports: from typing import Tuple
  import numpy
  import coremltools.converters.mil.mil.types
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.mil import Block
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Operation, Var
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import _check_child_op_type, _check_no_output_connection, block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 4 for calling the int_op_canonicalization obj's underlying member method code with example usage: obj.try_to_transform(dequantize, op, quantize) and returns: True, False