'Compute a histogram of the current tensor values.
Arguments:
tag (string): Tag to identify the current state of the tensor,
useful for disambiguating multiple histograms of the
same tensor at different points in time.
Returns:
Tensor containing the histogram data.'

def hist(self, tag):

    nbins = self.backend.hist_bins
    offset = self.backend.hist_offset
    bins = (np.arange((nbins + 1)) + float(offset))
    bins[0] = (- float('Inf'))
    np_inp_log_abs = np.rint(np.log2(np.abs(self._tensor.astype(np.float32))))
    (np_hist, edges) = np.histogram(np_inp_log_abs, density=False, bins=bins)
    nc_hist = self.backend._hist_tensor(tag)._assign(np_hist)
    return nc_hist
