This commit is contained in:
Awni Hannun
2024-09-14 16:09:09 -07:00
committed by GitHub
parent b3f52c9fbe
commit d6492b0163
3 changed files with 19 additions and 3 deletions

View File

@@ -838,7 +838,7 @@ array clip(
if (!a_min.has_value() && !a_max.has_value()) {
throw std::invalid_argument("At most one of a_min and a_max may be None");
}
array result = astype(a, a.dtype(), s);
array result = a;
if (a_min.has_value()) {
result = maximum(result, a_min.value(), s);
}