Skip to content
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

Delete Device2Host caused by comm with device and host #2840

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,14 @@ def _binary_precision_recall_curve_format(
preds = preds[idx]
target = target[idx]

if not torch.all((preds >= 0) * (preds <= 1)):
preds = preds.sigmoid()
# "sigmoid_cpu" not implemented for 'Half'
if preds.dtype != torch.float16 or preds.device != torch.device("cpu"):
out_of_bounds = (preds < 0) | (preds > 1)
out_of_bounds = out_of_bounds.any()
preds = torch.where(out_of_bounds, preds.sigmoid(), preds)
else:
if not torch.all((preds >= 0) * (preds <= 1)):
preds = preds.sigmoid()

thresholds = _adjust_threshold_arg(thresholds, preds.device)
return preds, target, thresholds
Expand Down Expand Up @@ -761,8 +767,15 @@ def _multilabel_precision_recall_curve_format(
"""
preds = preds.transpose(0, 1).reshape(num_labels, -1).T
target = target.transpose(0, 1).reshape(num_labels, -1).T
if not torch.all((preds >= 0) * (preds <= 1)):
preds = preds.sigmoid()

# "sigmoid_cpu" not implemented for 'Half'
if preds.dtype != torch.float16 or preds.device != torch.device("cpu"):
out_of_bounds = (preds < 0) | (preds > 1)
out_of_bounds = out_of_bounds.any()
preds = torch.where(out_of_bounds, preds.sigmoid(), preds)
else:
if not torch.all((preds >= 0) * (preds <= 1)):
preds = preds.sigmoid()

thresholds = _adjust_threshold_arg(thresholds, preds.device)
if ignore_index is not None and thresholds is not None:
Expand Down
Loading