Skip to content
Merged
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
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ def run(self):
"torch/csrc/jit/export.cpp",
"torch/csrc/jit/import.cpp",
"torch/csrc/jit/autodiff.cpp",
"torch/csrc/jit/interpreter_autograd_function.cpp",
"torch/csrc/jit/python_arg_flatten.cpp",
"torch/csrc/jit/variable_flags.cpp",
"torch/csrc/jit/passes/create_autodiff_subgraphs.cpp",
Expand Down
2 changes: 1 addition & 1 deletion test/expect/TestJit.test_dropout.expect
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
graph(%0 : Double(2, 2)) {
%1 : Double(2, 2), %2 : Handle = ^Dropout(0.6, True, False)(%0), scope: Dropout
%1 : Double(2, 2) = ^Dropout(0.6, True, False)(%0), scope: Dropout
return (%1);
}
1 change: 0 additions & 1 deletion tools/cpp_build/libtorch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ set(TORCH_SRCS
${TORCH_SRC_DIR}/csrc/jit/tracer_state.cpp
${TORCH_SRC_DIR}/csrc/jit/autodiff.cpp
${TORCH_SRC_DIR}/csrc/jit/type.cpp
${TORCH_SRC_DIR}/csrc/jit/interpreter_autograd_function.cpp
${TORCH_SRC_DIR}/csrc/jit/export.cpp
${TORCH_SRC_DIR}/csrc/jit/import.cpp
${TORCH_SRC_DIR}/csrc/onnx/onnx.cpp
Expand Down
1 change: 0 additions & 1 deletion torch/csrc/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ static PyObject* initModule() {
ASSERT_TRUE(THPVariable_initModule(module));
ASSERT_TRUE(THPFunction_initModule(module));
ASSERT_TRUE(THPEngine_initModule(module));
torch::autograd::initAutogradClosureBindings(module);
torch::jit::initJITBindings(module);
torch::onnx::initONNXBindings(module);
torch::autograd::initNNFunctions(module);
Expand Down
2 changes: 0 additions & 2 deletions torch/csrc/autograd/autograd.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ void THPAutograd_initFunctions();

namespace torch { namespace autograd {

void initAutogradClosureBindings(PyObject* module);

PyMethodDef* python_functions();

}}
Expand Down
6 changes: 1 addition & 5 deletions torch/csrc/autograd/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ variable_list Function::traced_apply(variable_list inputs) {

// Insert a CppOp in the trace.
auto& graph = state->graph;
std::vector<VariableFlags> var_flags;
for(auto & input: inputs) {
var_flags.push_back(VariableFlags::of(input));
}
auto* this_node = graph->createCppOp(get_shared_ptr(), std::move(var_flags));
auto* this_node = graph->createCppOp(get_shared_ptr());
#ifndef NO_PYTHON
this_node->setSourceLocation(std::make_shared<StringSourceLocation>(
jit::tracer::getPythonInterpreterStackTrace()
Expand Down
19 changes: 0 additions & 19 deletions torch/csrc/autograd/functions/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "basic_ops.h"
#include "tensor.h"
#include "special.h"
#include "torch/csrc/jit/interpreter_autograd_function.h"
#include "torch/csrc/autograd/functions/pybind.h"
#include "torch/csrc/autograd/python_cpp_function.h"
#include "torch/csrc/autograd/generated/python_functions.h"
Expand Down Expand Up @@ -99,9 +98,6 @@ void THPAutograd_initFunctions()
static PyTypeObject EvalClass;
addClass<Eval, NoCtor>(module, EvalClass, "Eval");

static PyTypeObject InterpreterAutogradClass;
addClass<torch::jit::InterpreterAutogradFunction, NoCtor>(module, InterpreterAutogradClass, "InterpreterAutogradFunction");

static PyTypeObject CopyBackwardsClass;
addClass<CopyBackwards, NoCtor>(module, CopyBackwardsClass, "CopyBackwards");

Expand All @@ -118,18 +114,3 @@ void THPAutograd_initFunctions()
throw python_error();
}
}

namespace torch { namespace autograd {

void initAutogradClosureBindings(PyObject* module) {
auto m = py::handle(module).cast<py::module>();
py::class_<jit::InterpreterFunctionFactory,std::shared_ptr<jit::InterpreterFunctionFactory>>(m, "InterpreterFunctionFactory")
.def("__call__", &jit::InterpreterFunctionFactory::construct_function)
;

m.def("_jit_createInterpreterFactory", [](jit::tracer::TracingState* tracing_state) {
return std::make_shared<jit::InterpreterFunctionFactory>(tracing_state);
});
}

}}
14 changes: 1 addition & 13 deletions torch/csrc/autograd/python_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,19 +602,7 @@ static void _trace_post_record(

auto state_lock = trace_info.state->lock();
trace_info.n->i_(attr::inplace, is_inplace);

// See definition in function.cpp.
THPObjectPtr passes_py_bool {PyObject_GetAttrString(op_obj, "is_traceable")};
if (!passes_py_bool) throw python_error();
bool passes_state_transparently = passes_py_bool == Py_True;
// NB: this path is executed only for forward of Python functions, so there's no need to check
// tracing_state->in_eval_subgraph (it's always false, because they are never part of backward
// subgraphs AND we don't even materialize the forward function).
if (trace_info.state->creates_handles && !passes_state_transparently) {
// TODO: sgross and ezyang don't know if this is right
tracer::nontraceableBackwardSubgraph(input_vars, output_vars);
Function::set_up_context_edge(trace_info.n, input_vars, output_vars);
}

}

PyObject* process_outputs(PyObject *op_obj, THPFunction* grad_fn, const UnpackedInput& unpacked,
Expand Down
Loading