Skip to content

Commit

Permalink
[reland]Replace AutoNonVariableTypeMode with InferenceMode in static …
Browse files Browse the repository at this point in the history
…runtime. (pytorch#55731)

Summary:
Pull Request resolved: pytorch#55731

Forgot to export the diff in my last one. Retry...

Test Plan:
https://www.internalfb.com/intern/aibench/details/3752129704
https://www.internalfb.com/intern/aibench/details/1306815519

Reviewed By: hlu1

Differential Revision: D27694660

fbshipit-source-id: b351338fa789b9e9c7337df9b1bc1bc0fc387f5d
  • Loading branch information
Ailing Zhang authored and facebook-github-bot committed Apr 12, 2021
1 parent 211d31a commit c6d9ca0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions torch/csrc/jit/runtime/static/impl.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <torch/csrc/jit/runtime/static/impl.h>

#include <ATen/core/LegacyTypeDispatch.h>
#include <ATen/core/interned_strings.h>
#include <c10/core/CPUAllocator.h>
#include <c10/core/InferenceMode.h>
#include <caffe2/core/scope_guard.h>
#include <caffe2/core/timer.h>
#include <torch/csrc/jit/ir/alias_analysis.h>
Expand Down Expand Up @@ -694,7 +694,7 @@ c10::IValue StaticRuntime::operator()(
// autograd. Enabling this is a significant win on dispatcher
// overhead because it saves a round of dispatch for at least some
// functions, such as resize_ and resize_as_.
at::AutoNonVariableTypeMode non_var_type_mode(true);
c10::InferenceMode mode;

if (planner_) {
planner_->allocate();
Expand Down Expand Up @@ -839,9 +839,9 @@ StaticRuntime::IndividualMetrics StaticRuntime::benchmark_individual_ops(
const int main_runs) {
TORCH_CHECK(warmup_runs >= 0 && main_runs >= 1);

// See comment on above use of AutoNonVariableTypeMode for
// See comment on above use of InferenceMode for
// explanation.
at::AutoNonVariableTypeMode non_var_type_mode(true);
c10::InferenceMode mode;

IndividualMetrics results;
results.time_per_node.resize(nodes_.size(), 0);
Expand Down

0 comments on commit c6d9ca0

Please sign in to comment.