Caffe2 - Python API
A deep learning, cross platform ML framework
thnn.py
1 from .backend import FunctionBackend
2 
3 
4 class THNNFunctionBackend(FunctionBackend):
5 
6  def __reduce__(self):
7  return (_get_thnn_function_backend, ())
8 
9  def __deepcopy__(self, memo):
10  memo[id(self)] = self
11  return self
12 
13  def __copy__(self):
14  return self
15 
16 
17 def _get_thnn_function_backend():
18  return backend
19 
20 
21 def _initialize_backend():
22  from .._functions.thnn import _all_functions as _thnn_functions
23  for cls in _thnn_functions:
24  name = cls.__name__
25  backend.register_function(name, cls)
26 
27 
28 backend = THNNFunctionBackend()
29 _initialize_backend()