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

Method __init__

tensorpack/models/shape_utils.py:34–46  ·  view source on GitHub ↗
(self, tensor)

Source from the content-addressed store, hash-verified

32
33class StaticDynamicShape(object):
34 def __init__(self, tensor):
35 assert isinstance(tensor, tf.Tensor), tensor
36 ndims = tensor.shape.ndims
37 self.static = tensor.shape.as_list()
38 if tensor.shape.is_fully_defined():
39 self.dynamic = self.static[:]
40 else:
41 dynamic = tf.shape(tensor)
42 self.dynamic = [DynamicLazyAxis(dynamic, k) for k in range(ndims)]
43
44 for k in range(ndims):
45 if self.static[k] is not None:
46 self.dynamic[k] = StaticLazyAxis(self.static[k])
47
48 def apply(self, axis, f):
49 if self.static[axis] is not None:

Callers

nothing calls this directly

Calls 3

DynamicLazyAxisFunction · 0.85
StaticLazyAxisFunction · 0.85
shapeMethod · 0.80

Tested by

no test coverage detected