MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / apply

Method apply

tensorpack/models/shape_utils.py:48–59  ·  view source on GitHub ↗
(self, axis, f)

Source from the content-addressed store, hash-verified

46 self.dynamic[k] = StaticLazyAxis(self.static[k])
47
48 def apply(self, axis, f):
49 if self.static[axis] is not None:
50 try:
51 st = f(self.static[axis])
52 self.static[axis] = st
53 self.dynamic[axis] = StaticLazyAxis(st)
54 return
55 except TypeError:
56 pass
57 self.static[axis] = None
58 dyn = self.dynamic[axis]
59 self.dynamic[axis] = lambda: f(dyn())
60
61 def get_static(self):
62 return self.static

Callers 1

FixedUnPoolingFunction · 0.95

Calls 2

StaticLazyAxisFunction · 0.85
fFunction · 0.70

Tested by

no test coverage detected