Skip to content

Commit

Permalink
Throw in VK_GET_OP_FN if op is not found (pytorch#3028)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: pytorch#3028

Make yipjustin happy. Forgot this safeguard when I originally wrote the `OperatorRegistry` class.

Reviewed By: SS-JIA

Differential Revision: D56085588

fbshipit-source-id: ba116eab8054e3610011fd0c8ffc0aabe61ae8ea
  • Loading branch information
jorgep31415 authored and facebook-github-bot committed Apr 13, 2024
1 parent cd32712 commit 4d7dd03
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ bool OperatorRegistry::has_op(const std::string& name) {

OperatorRegistry::OpFunction& OperatorRegistry::get_op_fn(
const std::string& name) {
return table_.find(name)->second;
const auto it = table_.find(name);
VK_CHECK_COND(it != table_.end(), "Could not find operator with name ", name);
return it->second;
}

void OperatorRegistry::register_op(const std::string& name, OpFunction& fn) {
Expand Down

0 comments on commit 4d7dd03

Please sign in to comment.