1// RUN: mlir-opt %s --test-shape-function-report -verify-diagnostics 2 3module attributes {shape.lib = [@shape_lib]} { 4 5// expected-remark@+1 {{associated shape function: same_result_shape}} 6func.func @tanh(%arg: tensor<10x20xf32>) -> tensor<10x20xf32> 7 attributes {shape.function = @shape_lib::@same_result_shape} { 8 // expected-remark@+1 {{implements InferType op interface}} 9 %0 = math.tanh %arg : tensor<10x20xf32> 10 // expected-remark@+1 {{implements InferType op interface}} 11 %1 = "test.same_operand_result_type"(%0) : (tensor<10x20xf32>) -> tensor<10x20xf32> 12 return %1 : tensor<10x20xf32> 13} 14 15// The shape function library with some local functions. 16shape.function_library @shape_lib { 17 // Test shape function that returns the shape of input arg as result shape. 18 func @same_result_shape(%arg: !shape.value_shape) -> !shape.shape { 19 %0 = shape_of %arg : !shape.value_shape -> !shape.shape 20 return %0 : !shape.shape 21 } 22} mapping { 23 test.same_operand_result_type = @same_result_shape 24} 25 26} 27