mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Allow scatter type exception to be caught by checking in op (#1077)
* allow exception to be caught in main thread * only for gpu * more detailed scatter error
This commit is contained in:
@@ -2641,6 +2641,14 @@ array scatter(
|
||||
idx = astype(idx, dtype, s);
|
||||
}
|
||||
|
||||
// TODO, remove when scatter supports 64-bit outputs
|
||||
if (to_stream(s).device == Device::gpu && size_of(a.dtype()) == 8) {
|
||||
std::ostringstream msg;
|
||||
msg << "[scatter] GPU scatter does not yet support " << a.dtype()
|
||||
<< " for the input or updates.";
|
||||
throw std::invalid_argument(msg.str());
|
||||
}
|
||||
|
||||
inputs.insert(inputs.begin(), a);
|
||||
// TODO promote or cast?
|
||||
inputs.push_back(astype(updates, a.dtype(), s));
|
||||
|
||||
Reference in New Issue
Block a user