Remove Module._backend as it's not used anymore.

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/25342

Test Plan: Imported from OSS

Differential Revision: D17101571

Pulled By: gchanan

fbshipit-source-id: 2cda46fe197e26a1cacb5e912f535809973d306e
diff --git a/torch/nn/_functions/__init__.py b/torch/nn/_functions/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/torch/nn/_functions/__init__.py
+++ /dev/null
diff --git a/torch/nn/_functions/thnn/__init__.py b/torch/nn/_functions/thnn/__init__.py
deleted file mode 100644
index 917657a..0000000
--- a/torch/nn/_functions/thnn/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-_all_functions = []
diff --git a/torch/nn/backends/backend.py b/torch/nn/backends/backend.py
deleted file mode 100644
index 0ee709e..0000000
--- a/torch/nn/backends/backend.py
+++ /dev/null
@@ -1,17 +0,0 @@
-
-class FunctionBackend(object):
-
-    def __init__(self):
-        self.function_classes = {}
-
-    def __getattr__(self, name):
-        fn = self.function_classes.get(name)
-        if fn is None:
-            raise AttributeError(
-                "Could not find function class for [{}]".format(name))
-        return fn
-
-    def register_function(self, name, function_class):
-        if self.function_classes.get(name):
-            raise RuntimeError("Trying to register second function under name " + name + " in " + type(self).__name__)
-        self.function_classes[name] = function_class
diff --git a/torch/nn/backends/thnn.py b/torch/nn/backends/thnn.py
index fa7f510..22effb3 100644
--- a/torch/nn/backends/thnn.py
+++ b/torch/nn/backends/thnn.py
@@ -1,29 +1,4 @@
-from .backend import FunctionBackend
-
-
-class THNNFunctionBackend(FunctionBackend):
-
-    def __reduce__(self):
-        return (_get_thnn_function_backend, ())
-
-    def __deepcopy__(self, memo):
-        memo[id(self)] = self
-        return self
-
-    def __copy__(self):
-        return self
-
+# this is for historical pickle deserilaization, it is not used otherwise
 
 def _get_thnn_function_backend():
-    return backend
-
-
-def _initialize_backend():
-    from .._functions.thnn import _all_functions as _thnn_functions
-    for cls in _thnn_functions:
-        name = cls.__name__
-        backend.register_function(name, cls)
-
-
-backend = THNNFunctionBackend()
-_initialize_backend()
+    pass
diff --git a/torch/nn/modules/_functions.py b/torch/nn/modules/_functions.py
index 5832467..3d6465e 100644
--- a/torch/nn/modules/_functions.py
+++ b/torch/nn/modules/_functions.py
@@ -113,7 +113,6 @@
         ctx.alpha = alpha
         ctx.beta = beta
         ctx.k = k
-        ctx._backend = None
         ctx.scale = None
 
         assert input.dim() == 4
diff --git a/torch/nn/modules/module.py b/torch/nn/modules/module.py
index 6de8198..282d2dc 100644
--- a/torch/nn/modules/module.py
+++ b/torch/nn/modules/module.py
@@ -3,7 +3,6 @@
 import itertools
 
 import torch
-from ..backends.thnn import backend as thnn_backend
 from ..parameter import Parameter
 import torch.utils.hooks as hooks
 
@@ -79,7 +78,6 @@
         Initializes internal Module state, shared by both nn.Module and ScriptModule.
         """
         torch._C._log_api_usage_once("python.nn_module")
-        self._backend = thnn_backend
         self._parameters = OrderedDict()
         self._buffers = OrderedDict()
         self._backward_hooks = OrderedDict()