Can not log metric which is a tensor #7373
-
🐛 BugI get an error Full stack trace
To ReproduceI train the model below, which is multi-class / multi-dimensional classifier (have multiple class categories trained in one hierarchical model). The error seem to come from the following piece (running in loop is so that I can specify number of classes, which is different for different dimensions):
I was getting the same error when trying to save confusion matrix. Code sample
Expected behaviorMetrics should be rendered irrespective of dimension Environmentpytorch-lightning==1.2.7 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@sivakhno according to the |
Beta Was this translation helpful? Give feedback.
-
since you set |
Beta Was this translation helpful? Give feedback.
since you set
average=None
when you initialize theAccuracy
metric, the output will be the accuracy score calculated per class. As this is a non-scalar tensor andself.log
is only intended to be used with scalar tensors, you get this error.