MCPcopy Create free account
hub / github.com/apache/tvm / test_bilayout_shape

Function test_bilayout_shape

tests/python/s_tir/base/test_tir_data_layout.py:138–154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136
137
138def test_bilayout_shape():
139 bilayout = tvm.s_tir.sbijective_layout("NCHW", "NCHW16c")
140 assert isinstance(bilayout, tvm.s_tir.SBijectiveLayout)
141
142 dst_shape = bilayout.forward_shape((1, 32, 7, 7))
143 assert get_const_tuple(dst_shape) == (1, 2, 7, 7, 16)
144
145 src_shape = bilayout.backward_shape(dst_shape)
146 assert get_const_tuple(src_shape) == (1, 32, 7, 7)
147
148 bilayout = tvm.s_tir.sbijective_layout("OIHW", "OIHW[4o4i]")
149
150 dst_shape = bilayout.forward_shape((64, 28, 7, 7))
151 assert get_const_tuple(dst_shape) == (16, 7, 7, 7, 16)
152
153 src_shape = bilayout.backward_shape((2, 11, 4, 4, 16))
154 assert get_const_tuple(src_shape) == (8, 44, 4, 4)
155
156
157def test_bilayout_index():

Callers

nothing calls this directly

Calls 3

get_const_tupleFunction · 0.90
forward_shapeMethod · 0.80
backward_shapeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…