-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Replace value.numpy()[0] with float(value) #2686
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -177,8 +177,8 @@ def train(self, | |||
labels_src) | |||
|
|||
loss_src_seg = loss_src_seg_main + loss_src_seg_aux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file checked
# TODO use a function to record, print lossetc | ||
|
||
avg_loss += loss.numpy()[0] | ||
avg_loss += float(loss) | ||
mdice += np.mean(per_channel_dice) * 100 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
model.clear_gradients() | ||
avg_loss += loss.numpy()[0] | ||
avg_loss += float(loss) | ||
mdice += np.mean(per_channel_dice) * 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
To support 0 dim Tensor, replace
value.numpy()[0]
withfloat(value)
when the shape of value is[1]