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

Function get_data_format

tensorpack/utils/argtools.py:99–107  ·  view source on GitHub ↗
(data_format, keras_mode=True)

Source from the content-addressed store, hash-verified

97
98
99def get_data_format(data_format, keras_mode=True):
100 if keras_mode:
101 dic = {'NCHW': 'channels_first', 'NHWC': 'channels_last'}
102 else:
103 dic = {'channels_first': 'NCHW', 'channels_last': 'NHWC'}
104 ret = dic.get(data_format, data_format)
105 if ret not in dic.values():
106 raise ValueError("Unknown data_format: {}".format(data_format))
107 return ret
108
109
110def shape4d(a, data_format='NHWC'):

Callers 10

shape4dFunction · 0.85
map_common_tfargsFunction · 0.85
BatchNormFunction · 0.85
BatchNormFunction · 0.85
LayerNormFunction · 0.85
InstanceNormFunction · 0.85
GlobalAvgPoolingFunction · 0.85
FixedUnPoolingFunction · 0.85
Conv2DFunction · 0.85
Conv2DTransposeFunction · 0.85

Calls 2

formatMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected