MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / get_data_format

Function get_data_format

python/oneflow/ops/util/initializer_util.py:39–49  ·  view source on GitHub ↗
(data_format)

Source from the content-addressed store, hash-verified

37
38
39def get_data_format(data_format):
40 assert isinstance(data_format, str), "data_format must be a string"
41 if data_format.startswith("NC"):
42 return "channels_first"
43 elif data_format.startswith("N") and data_format.endswith("C"):
44 return "channels_last"
45 else:
46 assert data_format == "", ValueError(
47 'data_format must be "N...C" or "NC..." or ""'
48 )
49 return ""
50
51
52def calc_fan(shape, mode, data_format):

Callers 4

xavier_uniform_Function · 0.90
xavier_normal_Function · 0.90
kaiming_uniform_Function · 0.90
kaiming_normal_Function · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected