Skip to content

Commit

Permalink
Use const_cast to remove const.
Browse files Browse the repository at this point in the history
  • Loading branch information
qqaatw committed Feb 24, 2023
1 parent 79b3c9f commit 11c289b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions aten/src/ATen/native/mps/operations/BinaryKernel.mm
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,20 @@ void fmax_fmin_mps_impl(TensorIteratorBase& iter, const std::string max_min) {
}
});
}
} // namespace at::native
} // namespace mps

void fmax_mps_kernel(TensorIteratorBase& iter) {
if (isFloatingType(iter.common_dtype())) {
mps::fmax_fmin_mps_impl(iter, "max");
} else {
Tensor output(iter.output(0));
at::_ops::maximum_out::call(iter.input(0), iter.input(1), output);
at::maximum_out(const_cast<Tensor&>(iter.output()), iter.input(0), iter.input(1));
}
}
void fmin_mps_kernel(TensorIteratorBase& iter) {
if (isFloatingType(iter.common_dtype())) {
mps::fmax_fmin_mps_impl(iter, "min");
} else {
Tensor output(iter.output(0));
at::_ops::minimum_out::call(iter.input(0), iter.input(1), output);
at::minimum_out(const_cast<Tensor&>(iter.output()), iter.input(0), iter.input(1));
}
}

Expand Down

0 comments on commit 11c289b

Please sign in to comment.