class_docstr: The input value (threshold) at which the output of a a ternary activation
  changes is configurable. This pass extracts that threshold point, inserting
  a BatchNormalization layer to execute the scaling. That BatchNormalization
  layer is then expected to be fused into a BatchNormalizationQuantizedTanh
  layer configured with the correct threshold.
class_docstr_tok: ["The","input","value","(","threshold",")","at","which","the","output","of","a","a","ternary","activation","changes","is","configurable",".","This","pass","extracts","that","threshold","point",",","inserting","a","BatchNormalization","layer","to","execute","the","scaling",".","That","BatchNormalization","layer","is","then","expected","to","be","fused","into","a","BatchNormalizationQuantizedTanh","layer","configured","with","the","correct","threshold","."]
code: def transform(self, model, node):
      shape = node.get_input_variable().shape
      scale = np.full(shape, 0.5 / node.get_attr("threshold", 0.5))
      bias = np.zeros_like(scale)
      node.set_attr("threshold", 0.5)
  
      attrs = {
          "name": node.get_attr("name") + "_scale",
          "class_name": "Alpha",
          "inputs": node.get_input_node().outputs,
          "outputs": node.inputs,
          "n_in": node.get_attr("n_in"),
          "n_filt": node.get_attr("n_filt", -1),
          "reuse_factor": node.get_attr("reuse_factor"),
          "scale_data": scale,
          "bias_data": bias,
          "trace": node.get_attr("trace", False),
      }
  
      layer = model.make_node(
          ApplyAlpha, node.name + "_scale", attrs, node.inputs.copy()
      )
      model.insert_node(layer, before=node)
      return True
  
imports: import numpy
  import tensorflow
  from hls4ml.model.layers import BatchNormalization, register_layer
  from hls4ml.model.optimizer import ConfigurableOptimizerPass, OptimizerPass, register_pass
  from hls4ml.model.types import FixedPrecisionType, IntegerPrecisionType, NamedType, QKerasPO2Quantizer
label_desc: Use image node_id 2 for calling the ExtractTernaryThreshold obj's underlying member method code with example usage: obj.transform(model, node) and returns: True