()
| 220 | |
| 221 | |
| 222 | def 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 | |
| 253 | def test_split_v_dynamic(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…