Skip to content

Commit

Permalink
Address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
codereport committed Nov 24, 2021
1 parent 17661c4 commit ad09990
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cpp/src/unary/cast_ops.cu
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ struct dispatch_unary_cast_to {

if constexpr (sizeof(SourceDeviceT) < sizeof(TargetDeviceT)) {
// device_cast BEFORE rescale when SourceDeviceT is < TargetDeviceT
return detail::rescale<TargetT>(*casted(), scale_type{type.scale()}, stream, mr);
auto temporary = casted();
return detail::rescale<TargetT>(*temporary, scale_type{type.scale()}, stream, mr);
} else {
// device_cast AFTER rescale when SourceDeviceT is > TargetDeviceT to avoid overflow
auto temporary = detail::rescale<SourceT>(input, scale_type{type.scale()}, stream, mr);
Expand Down

0 comments on commit ad09990

Please sign in to comment.