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

Function test_split

tests/python/relax/test_frontend_tflite.py:222–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220
221
222def test_split():
223 class Split(tf.Module):
224 @tf.function(input_signature=[tf.TensorSpec(shape=(1, 30), dtype=tf.float32)])
225 def func(self, x):
226 a, b, c = tf.split(x, 3, axis=1)
227 return tf.raw_ops.Pack(values=[a, b, c], axis=1)
228
229 @I.ir_module
230 class Expected:
231 @R.function
232 def main(x: R.Tensor((1, 30), dtype="float32")) -> R.Tensor((1, 3, 10), dtype="float32"):
233 R.func_attr({"num_input": 1})
234 with R.dataflow():
235 lv: R.Tuple(
236 R.Tensor((1, 10), dtype="float32"),
237 R.Tensor((1, 10), dtype="float32"),
238 R.Tensor((1, 10), dtype="float32"),
239 ) = R.split(x, indices_or_sections=3, axis=1)
240 lv1: R.Tensor((1, 10), dtype="float32") = lv[0]
241 lv2: R.Tensor((1, 1, 10), dtype="float32") = R.expand_dims(lv1, axis=[1])
242 lv3: R.Tensor((1, 10), dtype="float32") = lv[1]
243 lv4: R.Tensor((1, 1, 10), dtype="float32") = R.expand_dims(lv3, axis=[1])
244 lv5: R.Tensor((1, 10), dtype="float32") = lv[2]
245 lv6: R.Tensor((1, 1, 10), dtype="float32") = R.expand_dims(lv5, axis=[1])
246 gv: R.Tensor((1, 3, 10), dtype="float32") = R.concat((lv2, lv4, lv6), axis=1)
247 R.output(gv)
248 return gv
249
250 verify(Split, Expected)
251
252
253def test_split_v_dynamic():

Callers

nothing calls this directly

Calls 1

verifyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…