Skip to content

Commit

Permalink
fix the fuser pass (pytorch#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
zheng-xq authored and Mikhail Zolotukhin committed Feb 18, 2020
1 parent 4d59c21 commit 04a180c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions torch/csrc/jit/passes/tensorexpr_fuser.cpp
Expand Up @@ -301,6 +301,7 @@ struct TensorExprKernel {
std::vector<Tensor> tensor_outputs;
std::unordered_map<int64_t, Tensor> tensors;
std::unique_ptr<CodeGen> codegen;
Kernel kernel_arena;

Expr constant(torch::jit::Value* v) {
if (v->node()->kind() == prim::Constant) {
Expand Down Expand Up @@ -659,6 +660,7 @@ struct TensorExprKernel {
}

explicit TensorExprKernel(const Node* node) {
KernelScope kernel_scope(kernel_arena);
auto subgraph = node->g(attr::Subgraph);

// Bind inputs to buffers.
Expand Down Expand Up @@ -714,6 +716,7 @@ struct TensorExprKernel {
}

void run(Stack& stack) {
KernelScope kernel_scope(kernel_arena);
// Set up arguments (inputs, then outputs) for kernel call.
auto inputs = last(stack, buffer_args.size());
for (int i = 0; i < buffer_args.size(); i++) {
Expand Down

0 comments on commit 04a180c

Please sign in to comment.