module {
  func.func @main(%grad: tensor<2x7xf32>, %threshold: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.abs %grad : tensor<2x7xf32>
    %v2 = stablehlo.compare GT, %v1, %threshold, FLOAT : (tensor<2x7xf32>, tensor<2x7xf32>) -> tensor<2x7xi1>
    %v3 = stablehlo.constant dense<1.00000000000000000e+00> : tensor<2x7xf32>
    %v4 = stablehlo.select %v2, %v3, %v0 : tensor<2x7xi1>, tensor<2x7xf32>
    %v5 = stablehlo.multiply %v1, %v4 : tensor<2x7xf32>
    %v6 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<f32>
    %v7 = stablehlo.reduce(%v5 init: %v6) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v8 = stablehlo.broadcast_in_dim %v7, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v9 = stablehlo.reduce(%v4 init: %v6) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v10 = stablehlo.broadcast_in_dim %v9, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v11 = stablehlo.maximum %v10, %v3 : tensor<2x7xf32>
    %v12 = stablehlo.divide %v8, %v11 : tensor<2x7xf32>
    %v13 = stablehlo.sign %grad : tensor<2x7xf32>
    %v14 = stablehlo.multiply %v13, %v4 : tensor<2x7xf32>
    %v15 = stablehlo.multiply %v12, %v14 : tensor<2x7xf32>
    return %v14, %v15, %v12 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}
