code: def one_step(
      writer, temp, ambient_temperature, heat_coefficient, step
  ):
      """Runs one step of the temperature simulation.
  
      Will update the `temperature` argument with one step of heat diffusion.
  
      Arguments:
        writer: The tf.summary.SummaryWriter object.
        temp: The tf.Variable containing the value being updated.  Akin
          to a weight in a model.
        ambient_temperature: The `tf.Constant` value the temperature is being
          drawn towards.
        heat_coefficient: tf.Constant describing rate of diffusion.
        step: tf.int64 value of the current step number.  Used in the
          `summary.scalar` API.
      """
      with writer.as_default():
          with tf.name_scope("temperature"):
              tf.summary.scalar(
                  name="current",
                  data=temp,
                  step=step,
                  description="The temperature of the object, in Kelvins.",
              )
              # Compute how much the object's temperature differs from that of
              #  its environment, and track this, too: likewise, as
              # "temperature/difference_to_ambient".
              ambient_difference = temp - ambient_temperature
              tf.summary.scalar(
                  name="difference_to_ambient",
                  data=ambient_difference,
                  step=step,
                  description="The difference between the ambient "
                  "temperature and the temperature of the "
                  "object under simulation, in Kelvins.",
              )
          # Newton suggested that the rate of change of the temperature of
          # an object is directly proportional to this
          # `ambient_difference` above, where the proportionality constant
          # is what we called the heat coefficient. But in real life, not
          # everything is quite so clean, so we'll add in some noise. (The
          # value of 50 is arbitrary, chosen to
          # make the data look somewhat interesting. :-) )
          noise = 50 * tf.random.normal([])
          delta = -heat_coefficient * (ambient_difference + noise)
          tf.summary.scalar(
              name="delta",
              data=delta,
              step=step,
              description="The change in temperature from the previous "
              "step, in Kelvins.",
          )
          temp.assign_add(delta)
  
imports: import os.path
  from absl import app
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: one_step(writer, temp, ambient_temperature, heat_coefficient, step) without return types