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

Function slayout

python/tvm/s_tir/data_layout.py:167–190  ·  view source on GitHub ↗

Create a layout node from a string. Parameters ---------- layout_str : str A layout representation is composed of upper cases, lower cases and numbers, where upper case indicates a primal axis and the corresponding lower case with factor size indicates the subord

(layout_str: str, dtype: str = "int32")

Source from the content-addressed store, hash-verified

165
166
167def slayout(layout_str: str, dtype: str = "int32") -> SLayout:
168 """Create a layout node from a string.
169
170 Parameters
171 ----------
172 layout_str : str
173 A layout representation is composed of upper cases, lower cases and numbers,
174 where upper case indicates a primal axis and
175 the corresponding lower case with factor size indicates the subordinate axis.
176 For example, NCHW16c can describe a 5-D tensor of
177 [batch_size, channel, height, width, channel_block].
178 Here subordinate axis channel_block=16 is the factor size of
179 the primal axis C (channel).
180
181 dtype : str
182 The dtype of generated axes vars in the returned layout.
183 It is required to be integer type.
184
185 Returns
186 -------
187 layout : SLayout
188 The created layout
189 """
190 return _ffi_api.SLayout(layout_str, dtype) # type: ignore
191
192
193def sbijective_layout(src_layout: str | SLayout, dst_layout: str | SLayout) -> SBijectiveLayout:

Callers 2

get_shapeFunction · 0.90
sbijective_layoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…