def scalar_summary(tag, scalar):
tag = _clean_tag(tag)<EOL>scalar = _make_numpy_array(scalar)<EOL>assert(scalar.squeeze().ndim == <NUM_LIT:0>), '<STR_LIT>'<EOL>scalar = float(scalar)<EOL>return Summary(value=[Summary.Value(tag=tag, simple_value=scalar)])<EOL>
Outputs a `Summary` protocol buffer containing a single scalar value.
    The generated Summary has a Tensor.proto containing the input Tensor.
    Adapted from the TensorFlow function `scalar()` at
    https://github.com/tensorflow/tensorflow/blob/r1.6/tensorflow/python/summary/summary.py

    Parameters
    ----------
      tag : str
          A name for the generated summary. Will also serve as the series name in TensorBoard.
      scalar : int, MXNet `NDArray`, or `numpy.ndarray`
          A scalar value or an ndarray of shape (1,).

    Returns
    -------
      A `Summary` protobuf of the `scalar` value.

    Raises
    ------
      ValueError: If the scalar has the wrong shape or type.