Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions torch/csrc/jit/runtime/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,10 @@ struct CodeImpl {
}

void emitWarn(Node* node) {
if (FLAGS_torch_jit_disable_warning_prints) {
return;
}

emitLoadInputs(node->inputs());
int32_t idx = -1;
if (node->hasAttribute(attr::warn_id)) {
Expand Down
2 changes: 2 additions & 0 deletions torch/csrc/jit/runtime/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <torch/csrc/WindowsTorchApiMacro.h>
#include <torch/csrc/jit/frontend/source_range.h>

C10_DECLARE_bool(torch_jit_disable_warning_prints);

namespace at {
class Tensor;
CAFFE2_API void launch(std::function<void()> func);
Expand Down
5 changes: 5 additions & 0 deletions torch/csrc/jit/runtime/profiling_graph_executor_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ C10_DEFINE_bool(
true,
"If this flag is set to false TorchScript will be using the legacy/original executor");

C10_DEFINE_bool(
torch_jit_disable_warning_prints,
false,
"Disables warning.warn prints in TorchScript graph");

constexpr size_t kDefaultNumProfiledRuns = 1;
constexpr size_t kDefaultBailoutDepth = 20;

Expand Down