Lines Matching full:shape

3 func.func @reduce_op_args_num_mismatch(%shape : !shape.shape, %init : !shape.size) {
5 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
6 ^bb0(%index: index, %dim: !shape.size):
7 shape.yield %dim : !shape.size
14 func.func @reduce_op_arg0_wrong_type(%shape : !shape.shape, %init : !shape.size) {
16 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
17 ^bb0(%index: f32, %dim: !shape.size, %acc: !shape.size):
18 %new_acc = "shape.add"(%acc, %dim)
19 : (!shape.size, !shape.size) -> !shape.size
20 shape.yield %new_acc : !shape.size
27 func.func @reduce_op_arg1_wrong_type(%shape : !shape.shape, %init : !shape.size) {
29 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
30 ^bb0(%index: index, %dim: f32, %lci: !shape.size):
31 shape.yield
38 func.func @reduce_op_arg1_wrong_type(%shape : tensor<?xindex>, %init : index) {
40 %num_elements = shape.reduce(%shape, %init) : tensor<?xindex> -> index {
42 shape.yield
49 func.func @reduce_op_init_type_mismatch(%shape : !shape.shape, %init : f32) {
51 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> f32 {
52 ^bb0(%index: index, %dim: !shape.size, %lci: !shape.size):
53 shape.yield
60 func.func @yield_op_args_num_mismatch(%shape : !shape.shape, %init : !shape.size) {
62 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
63 ^bb0(%index: index, %dim: !shape.size, %lci: !shape.size):
64 shape.yield %dim, %dim : !shape.size, !shape.size
71 func.func @yield_op_type_mismatch(%shape : !shape.shape, %init : !shape.size) {
73 %num_elements = shape.reduce(%shape, %init) : !shape.shape -> !shape.size {
74 ^bb0(%index: index, %dim: !shape.size, %lci: !shape.size):
76 shape.yield %c0 : index
85 %w0 = shape.assuming_all
91 func.func @shape_of(%value_arg : !shape.value_shape,
93 …ne of the operands can hold error values then the result must be of type `shape` to propagate them…
94 %0 = shape.shape_of %value_arg : !shape.value_shape -> tensor<?xindex>
102 …// expected-error@+1 {{'shape.shape_of' op inferred type(s) 'tensor<2xindex>' are incompatible wit…
103 %0 = shape.shape_of %value_arg : tensor<1x2xindex> -> tensor<3xindex>
109 func.func @rank(%arg : !shape.shape) {
111 %0 = shape.rank %arg : !shape.shape -> index
118 %c0 = shape.const_size 0
120 %result = shape.get_extent %arg, %c0 : tensor<?xindex>, !shape.size -> index
126 func.func @mul(%lhs : !shape.size, %rhs : index) -> index {
128 %result = shape.mul %lhs, %rhs : !shape.size, index -> index
134 func.func @num_elements(%arg : !shape.shape) -> index {
136 %result = shape.num_elements %arg : !shape.shape -> index
142 func.func @add(%lhs : !shape.size, %rhs : index) -> index {
144 %result = shape.add %lhs, %rhs : !shape.size, index -> index
150 func.func @broadcast(%arg0 : !shape.shape, %arg1 : !shape.shape) -> tensor<?xindex> {
151 …ne of the operands can hold error values then the result must be of type `shape` to propagate them…
152 %result = shape.broadcast %arg0, %arg1
153 : !shape.shape, !shape.shape -> tensor<?xindex>
160 func.func @broadcast(%arg0 : !shape.shape, %arg1 : tensor<?xindex>) -> tensor<?xindex> {
161 …ne of the operands can hold error values then the result must be of type `shape` to propagate them…
162 %result = shape.broadcast %arg0, %arg1
163 : !shape.shape, tensor<?xindex> -> tensor<?xindex>
169 // Test using an unsupported shape.lib attribute type.
171 // expected-error@+1 {{only SymbolRefAttr allowed in shape.lib attribute array}}
172 module attributes {shape.lib = [@shape_lib, "shape_lib"]} {
174 shape.function_library @shape_lib {
175 // Test shape function that returns the shape of input arg as result shape.
176 func.func @same_result_shape(%arg: !shape.value_shape) -> !shape.shape {
177 %0 = shape.shape_of %arg : !shape.value_shape -> !shape.shape
178 return %0 : !shape.shape
188 // Test that duplicate op to shape function mappings are flagged, this uses
191 // expected-error@+1 {{only one op to shape mapping allowed}}
192 module attributes {shape.lib = [@shape_lib, @shape_lib]} {
194 shape.function_library @shape_lib {
195 // Test shape function that returns the shape of input arg as result shape.
196 func.func @same_result_shape(%arg: !shape.value_shape) -> !shape.shape {
197 %0 = shape.shape_of %arg : !shape.value_shape -> !shape.shape
198 return %0 : !shape.shape
208 // Test that duplicate op to shape function mappings are flagged (this is
212 module attributes {shape.lib = [@shape_lib]} {
214 shape.function_library @shape_lib {
215 // Test shape function that returns the shape of input arg as result shape.
216 func.func @same_result_shape(%arg: !shape.value_shape) -> !shape.shape {
217 %0 = shape.shape_of %arg : !shape.value_shape -> !shape.shape
218 return %0 : !shape.shape
230 // Test that op referred to by shape lib is a shape function library.
232 // expected-error@+1 {{required to be shape function library}}
233 module attributes {shape.lib = @fn} {
235 func.func @fn(%arg: !shape.value_shape) -> !shape.shape {
236 %0 = shape.shape_of %arg : !shape.value_shape -> !shape.shape
237 return %0 : !shape.shape
244 // Test that op referred to by shape lib is a shape function library.
246 func.func @fn(%arg: !shape.value_shape) -> !shape.shape {
248 %0 = shape.shape_of %arg {shape.lib = @fn} : !shape.value_shape -> !shape.shape
249 return %0 : !shape.shape
254 // Test that shape function library is defined.
257 module attributes {shape.lib = @fn} { }
261 func.func @fn(%arg: !shape.shape) -> !shape.witness {
263 %0 = shape.cstr_broadcastable %arg : !shape.shape
264 return %0 : !shape.witness
274 %0 = shape.const_shape [4, 5, 6] : tensor<2xindex>
280 func.func @invalid_meet(%arg0 : !shape.shape, %arg1 : index) -> index {
283 %result = shape.meet %arg0, %arg1 : !shape.shape, index -> index
291 // expected-error@+1 {{unequal shape cardinality}}
292 %result = shape.meet %arg0, %arg1 : tensor<2xindex>, tensor<3xindex> -> tensor<?xindex>