code: def __init__(
      self,
      model,
      input_record,
      name="homotopy_weight",
      min_weight=0.0,
      max_weight=1.0,
      half_life=1e6,
      quad_life=3e6,
      atomic_iter=None,
      **kwargs,
  ):
      super(HomotopyWeight, self).__init__(
          model, name, input_record, **kwargs
      )
      self.output_schema = schema.Scalar(
          np.float32, self.get_next_blob_reference("homotopy_weight")
      )
      data = self.input_record.field_blobs()
      assert len(data) == 2
      self.x = data[0]
      self.y = data[1]
      # TODO: currently model building does not have access to iter counter or
      # learning rate; it's added at optimization time;
      self.use_external_iter = atomic_iter is not None
      self.atomic_iter = (
          atomic_iter
          if self.use_external_iter
          else self.create_atomic_iter()
      )
      # to map lr to [min, max]; alpha = scale * lr + offset
      assert max_weight > min_weight
      self.scale = float(max_weight - min_weight)
      self.offset = self.model.add_global_constant(
          "%s_offset_1dfloat" % self.name, float(min_weight)
      )
      self.gamma, self.power = self.solve_inv_lr_params(
          half_life, quad_life
      )
  
file_path: pytorch/caffe2/python/layers/homotopy_weight.py
imports: from caffe2.python import core, schema
  from caffe2.python.layers.layers import ModelLayer
  import numpy
  import logging
label_desc: Use image node_id 1 to create a new HomotopyWeight object from inherited base classes: ModelLayer with example: obj = HomotopyWeight(model, input_record, name, min_weight, max_weight, half_life, quad_life, atomic_iter)