|
53 | 53 | module {
|
54 | 54 |
|
55 | 55 | func.func @expand_dense(%arg0: tensor<12xf64>) -> tensor<3x4xf64> {
|
56 |
| - %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64> into tensor<3x4xf64> |
| 56 | + %0 = tensor.expand_shape %arg0 [[0, 1]] output_shape [3, 4] : tensor<12xf64> into tensor<3x4xf64> |
57 | 57 | return %0 : tensor<3x4xf64>
|
58 | 58 | }
|
59 | 59 |
|
60 | 60 | func.func @expand_from_sparse(%arg0: tensor<12xf64, #SparseVector>) -> tensor<3x4xf64> {
|
61 |
| - %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64, #SparseVector> into tensor<3x4xf64> |
| 61 | + %0 = tensor.expand_shape %arg0 [[0, 1]] output_shape [3, 4] : tensor<12xf64, #SparseVector> into tensor<3x4xf64> |
62 | 62 | return %0 : tensor<3x4xf64>
|
63 | 63 | }
|
64 | 64 |
|
65 | 65 | func.func @expand_to_sparse(%arg0: tensor<12xf64>) -> tensor<3x4xf64, #SparseMatrix> {
|
66 |
| - %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64> into tensor<3x4xf64, #SparseMatrix> |
| 66 | + %0 = tensor.expand_shape %arg0 [[0, 1]] output_shape [3, 4] : tensor<12xf64> into tensor<3x4xf64, #SparseMatrix> |
67 | 67 | return %0 : tensor<3x4xf64, #SparseMatrix>
|
68 | 68 | }
|
69 | 69 |
|
70 | 70 | func.func @expand_sparse2sparse(%arg0: tensor<12xf64, #SparseVector>) -> tensor<3x4xf64, #SparseMatrix> {
|
71 |
| - %0 = tensor.expand_shape %arg0 [[0, 1]] : tensor<12xf64, #SparseVector> into tensor<3x4xf64, #SparseMatrix> |
| 71 | + %0 = tensor.expand_shape %arg0 [[0, 1]] output_shape [3, 4] : tensor<12xf64, #SparseVector> into tensor<3x4xf64, #SparseMatrix> |
72 | 72 | return %0 : tensor<3x4xf64, #SparseMatrix>
|
73 | 73 | }
|
74 | 74 |
|
75 | 75 | func.func @expand_dense_3x2x2(%arg0: tensor<3x4xf64>) -> tensor<3x2x2xf64> {
|
76 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<3x4xf64> into tensor<3x2x2xf64> |
| 76 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [3, 2, 2] : tensor<3x4xf64> into tensor<3x2x2xf64> |
77 | 77 | return %0 : tensor<3x2x2xf64>
|
78 | 78 | }
|
79 | 79 |
|
80 | 80 | func.func @expand_from_sparse_3x2x2(%arg0: tensor<3x4xf64, #SparseMatrix>) -> tensor<3x2x2xf64> {
|
81 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<3x4xf64, #SparseMatrix> into tensor<3x2x2xf64> |
| 81 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [3, 2, 2] : tensor<3x4xf64, #SparseMatrix> into tensor<3x2x2xf64> |
82 | 82 | return %0 : tensor<3x2x2xf64>
|
83 | 83 | }
|
84 | 84 |
|
85 | 85 | func.func @expand_to_sparse_3x2x2(%arg0: tensor<3x4xf64>) -> tensor<3x2x2xf64, #Sparse3dTensor> {
|
86 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<3x4xf64> into tensor<3x2x2xf64, #Sparse3dTensor> |
| 86 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [3, 2, 2] : tensor<3x4xf64> into tensor<3x2x2xf64, #Sparse3dTensor> |
87 | 87 | return %0 : tensor<3x2x2xf64, #Sparse3dTensor>
|
88 | 88 | }
|
89 | 89 |
|
90 | 90 | func.func @expand_sparse2sparse_3x2x2(%arg0: tensor<3x4xf64, #SparseMatrix>) -> tensor<3x2x2xf64, #Sparse3dTensor> {
|
91 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<3x4xf64, #SparseMatrix> into tensor<3x2x2xf64, #Sparse3dTensor> |
| 91 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [3, 2, 2] : tensor<3x4xf64, #SparseMatrix> into tensor<3x2x2xf64, #Sparse3dTensor> |
92 | 92 | return %0 : tensor<3x2x2xf64, #Sparse3dTensor>
|
93 | 93 | }
|
94 | 94 |
|
95 | 95 | func.func @expand_dense_dyn(%arg0: tensor<?x?xf64>) -> tensor<?x2x?xf64> {
|
96 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<?x?xf64> into tensor<?x2x?xf64> |
| 96 | + %c0 = arith.constant 0 : index |
| 97 | + %c1 = arith.constant 1 : index |
| 98 | + %c2 = arith.constant 2 : index |
| 99 | + %d0 = tensor.dim %arg0, %c0 : tensor<?x?xf64> |
| 100 | + %d1 = tensor.dim %arg0, %c1 : tensor<?x?xf64> |
| 101 | + %d2 = arith.divui %d1, %c2 : index |
| 102 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [%d0, 2, %d2] : tensor<?x?xf64> into tensor<?x2x?xf64> |
97 | 103 | return %0 : tensor<?x2x?xf64>
|
98 | 104 | }
|
99 | 105 |
|
100 | 106 | func.func @expand_from_sparse_dyn(%arg0: tensor<?x?xf64, #SparseMatrix>) -> tensor<?x2x?xf64> {
|
101 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<?x?xf64, #SparseMatrix> into tensor<?x2x?xf64> |
| 107 | + %c0 = arith.constant 0 : index |
| 108 | + %c1 = arith.constant 1 : index |
| 109 | + %c2 = arith.constant 2 : index |
| 110 | + %d0 = tensor.dim %arg0, %c0 : tensor<?x?xf64, #SparseMatrix> |
| 111 | + %d1 = tensor.dim %arg0, %c1 : tensor<?x?xf64, #SparseMatrix> |
| 112 | + %d2 = arith.divui %d1, %c2 : index |
| 113 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [%d0, 2, %d2] : tensor<?x?xf64, #SparseMatrix> into tensor<?x2x?xf64> |
102 | 114 | return %0 : tensor<?x2x?xf64>
|
103 | 115 | }
|
104 | 116 |
|
105 | 117 | func.func @expand_to_sparse_dyn(%arg0: tensor<?x?xf64>) -> tensor<?x2x?xf64, #Sparse3dTensor> {
|
106 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<?x?xf64> into tensor<?x2x?xf64, #Sparse3dTensor> |
| 118 | + %c0 = arith.constant 0 : index |
| 119 | + %c1 = arith.constant 1 : index |
| 120 | + %c2 = arith.constant 2 : index |
| 121 | + %d0 = tensor.dim %arg0, %c0 : tensor<?x?xf64> |
| 122 | + %d1 = tensor.dim %arg0, %c1 : tensor<?x?xf64> |
| 123 | + %d2 = arith.divui %d1, %c2 : index |
| 124 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [%d0, 2, %d2] : tensor<?x?xf64> into tensor<?x2x?xf64, #Sparse3dTensor> |
107 | 125 | return %0 : tensor<?x2x?xf64, #Sparse3dTensor>
|
108 | 126 | }
|
109 | 127 |
|
110 | 128 | func.func @expand_sparse2sparse_dyn(%arg0: tensor<?x?xf64, #SparseMatrix>) -> tensor<?x2x?xf64, #Sparse3dTensor> {
|
111 |
| - %0 = tensor.expand_shape %arg0 [[0], [1, 2]] : tensor<?x?xf64, #SparseMatrix> into tensor<?x2x?xf64, #Sparse3dTensor> |
| 129 | + %c0 = arith.constant 0 : index |
| 130 | + %c1 = arith.constant 1 : index |
| 131 | + %c2 = arith.constant 2 : index |
| 132 | + %d0 = tensor.dim %arg0, %c0 : tensor<?x?xf64, #SparseMatrix> |
| 133 | + %d1 = tensor.dim %arg0, %c1 : tensor<?x?xf64, #SparseMatrix> |
| 134 | + %d2 = arith.divui %d1, %c2 : index |
| 135 | + %0 = tensor.expand_shape %arg0 [[0], [1, 2]] output_shape [%d0, 2, %d2] : tensor<?x?xf64, #SparseMatrix> into tensor<?x2x?xf64, #Sparse3dTensor> |
112 | 136 | return %0 : tensor<?x2x?xf64, #Sparse3dTensor>
|
113 | 137 | }
|
114 | 138 |
|
|
0 commit comments