Caffe2 - C++ API
A deep learning, cross platform ML framework
inplace_check.cpp
1 #include <torch/csrc/jit/passes/inplace_check.h>
2 
3 namespace torch {
4 namespace jit {
5 
6 void CheckInplace(Block* block) {
7  for (auto node : block->nodes()) {
8  if (node->kind() == prim::PythonOp && node->hasAttribute(attr::inplace)) {
9  if (node->i(attr::inplace)) {
10  throw std::runtime_error(
11  std::string("inplace ") + static_cast<PythonOp*>(node)->name() +
12  " not supported in the JIT");
13  }
14  }
15  }
16 }
17 
18 void CheckInplace(std::shared_ptr<Graph>& graph) {
19  CheckInplace(graph->block());
20 }
21 
22 } // namespace jit
23 } // namespace torch
Definition: jit_type.h:17