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

Function shape2d

tensorpack/utils/argtools.py:81–96  ·  view source on GitHub ↗

Ensure a 2D shape. Args: a: a int or tuple/list of length 2 Returns: list: of length 2. if ``a`` is a int, return ``[a, a]``.

(a)

Source from the content-addressed store, hash-verified

79
80
81def shape2d(a):
82 """
83 Ensure a 2D shape.
84
85 Args:
86 a: a int or tuple/list of length 2
87
88 Returns:
89 list: of length 2. if ``a`` is a int, return ``[a, a]``.
90 """
91 if type(a) == int:
92 return [a, a]
93 if isinstance(a, (list, tuple)):
94 assert len(a) == 2
95 return list(a)
96 raise RuntimeError("Illegal shape: {}".format(a))
97
98
99def get_data_format(data_format, keras_mode=True):

Callers 10

DynamicConvFilterFunction · 0.90
shape4dFunction · 0.85
dump_dataflow_imagesFunction · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
FixedUnPoolingFunction · 0.85
Conv2DFunction · 0.85
Conv2DTransposeFunction · 0.85

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected