Caffe2 - Python API
A deep learning, cross platform ML framework
Packages
Classes
Files
C++ API
Python API
GitHub
File List
tools
autograd
nested_dict.py
1
# TODO: refactor nested_dict into common library with ATen
2
class
nested_dict
(object):
3
"""
4
A nested dict is a dictionary with a parent. If key lookup fails,
5
it recursively continues into the parent. Writes always happen to
6
the top level dict.
7
"""
8
9
def
__init__(self, base, parent):
10
self.base, self.
parent
= base, parent
11
12
def
__contains__(self, item):
13
return
item
in
self.base
or
item
in
self.
parent
14
15
def
__getitem__(self, x):
16
r = self.base.get(x)
17
if
r
is
not
None
:
18
return
r
19
return
self.
parent
[x]
tools.autograd.nested_dict.nested_dict
Definition:
nested_dict.py:2
tools.autograd.nested_dict.nested_dict.parent
parent
Definition:
nested_dict.py:10
Generated on Thu Mar 21 2019 13:06:37 for Caffe2 - Python API by
1.8.11