module {
  func.func @main(%x: tensor<2x7xf32>, %mask: tensor<2x7xf32>, %upstream: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.compare GT, %mask, %v0, FLOAT : (tensor<2x7xf32>, tensor<2x7xf32>) -> tensor<2x7xi1>
    %v2 = stablehlo.constant dense<3.40282339999999992e+38> : tensor<2x7xf32>
    %v3 = stablehlo.negate %v2 : tensor<2x7xf32>
    %v4 = stablehlo.select %v1, %x, %v3 : tensor<2x7xi1>, tensor<2x7xf32>
    %v5 = stablehlo.constant dense<-3.40282346000000007e+38> : tensor<f32>
    %v6 = stablehlo.reduce(%v4 init: %v5) applies stablehlo.maximum across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v7 = stablehlo.broadcast_in_dim %v6, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v8 = stablehlo.subtract %x, %v7 : tensor<2x7xf32>
    %v9 = stablehlo.constant dense<9.00000000000000000e+01> : tensor<2x7xf32>
    %v10 = stablehlo.negate %v9 : tensor<2x7xf32>
    %v11 = stablehlo.select %v1, %v8, %v10 : tensor<2x7xi1>, tensor<2x7xf32>
    %v12 = stablehlo.exponential %v11 : tensor<2x7xf32>
    %v13 = stablehlo.multiply %v12, %mask : tensor<2x7xf32>
    %v14 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<f32>
    %v15 = stablehlo.reduce(%v13 init: %v14) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v16 = stablehlo.broadcast_in_dim %v15, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v17 = stablehlo.constant dense<1.00000000000000008e-30> : tensor<2x7xf32>
    %v18 = stablehlo.maximum %v16, %v17 : tensor<2x7xf32>
    %v19 = stablehlo.divide %v13, %v18 : tensor<2x7xf32>
    %v20 = stablehlo.multiply %upstream, %v19 : tensor<2x7xf32>
    %v21 = stablehlo.reduce(%v20 init: %v14) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v22 = stablehlo.broadcast_in_dim %v21, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v23 = stablehlo.subtract %upstream, %v22 : tensor<2x7xf32>
    %v24 = stablehlo.multiply %v19, %v23 : tensor<2x7xf32>
    return %v19, %v24 : tensor<2x7xf32>, tensor<2x7xf32>
  }
}
