When I use the tensorboardX to plot my data loss, it show me that:
AssertionError Traceback (most recent call last)
<ipython-input-76-73419a51fcc9> in <module>
----> 1 writer.add_scalar('resnet34_loss', loss)
F:\Program Files\Python\lib\site-packages\tensorboardX\writer.py in add_scalar(self, tag, scalar_value, global_step, walltime)
403 scalar_value = workspace.FetchBlob(scalar_value)
404 self._get_file_writer().add_summary(
--> 405 scalar(tag, scalar_value), global_step, walltime)
406
407 def add_scalars(self, main_tag, tag_scalar_dict, global_step=None, walltime=None):
F:\Program Files\Python\lib\site-packages\tensorboardX\summary.py in scalar(name, scalar, collections)
145 name = _clean_tag(name)
146 scalar = make_np(scalar)
--> 147 assert(scalar.squeeze().ndim == 0), 'scalar should be 0D'
148 scalar = float(scalar)
149 return Summary(value=[Summary.Value(tag=name, simple_value=scalar)])
AssertionError: scalar should be 0D
I have turn the loss from float
into np.array
, and I have read the doc of tensorboardX, it tell me that add_scalar()
function must input the scalar data and I do it, but it shows me a bug. Thanks for your help!