Skip to content

Commit

Permalink
improve error messaging in eval (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
awni committed May 10, 2024
1 parent 2e158cf commit a9f80d6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mlx/transforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,15 @@ array eval_impl(std::vector<array> outputs, bool async) {
"[async_eval] Not allowed inside a graph transformation.");
}
if (!in.has_primitive()) {
throw std::invalid_argument(
"[eval] Attempting to eval an array without a primitive.");
if (in.is_tracer()) {
throw std::invalid_argument(
"[eval] Attempting to eval an array during function"
" transformations like compile or vmap is not allowed.");
}
throw std::runtime_error(
"[eval] Attempting to eval an array without a primitive. "
"This may be a bug, please file an issue here: "
" https://github.com/ml-explore/mlx/issues.");
}
if (a.primitive().stream() != in.primitive().stream()) {
needs_signal.insert(in.id());
Expand Down

0 comments on commit a9f80d6

Please sign in to comment.