<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def scalar(self, tag, value, step=None):
 """Saves scalar value. Args: tag: str: label for this data value: int/float: number to log step: int: training step """

    value = float(onp.array(value))
    if step is None:
      step = self._step
    else:
      self._step = step
    summary = Summary(value=[Summary.Value(tag=tag, simple_value=value)])
    self.add_summary(summary, step)