# AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _align as align
from torch import device, empty_strided
from torch._inductor.async_compile import AsyncCompile
from torch._inductor.select_algorithm import extern_kernels
from torch._inductor.codegen.multi_kernel import MultiKernelCall
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph
from torch._C import _cuda_getCurrentRawStream as get_raw_stream

aten = torch.ops.aten
inductor_ops = torch.ops.inductor
_quantized = torch.ops._quantized
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
alloc_from_pool = torch.ops.inductor._alloc_from_pool
async_compile = AsyncCompile()


# kernel path: runs/run_shard_4/inductor_cache/no/cnoevxmi56p67zph5bcvud6uollxe7h3vjriggenmd3qdtjq74rl.py
# Topologically Sorted Source Nodes: [max_1, tau_hi, tau_lo, dm, dm_1, tau_m, sub_6, p_m, sum_2, f_m, sub_3, clamp, sum_1, f_lo, mul_1, tau_lo_1, dm_2, tau_m_1, sub_8, p_m_1, sum_3, f_m_1, mul_2, tau_lo_2, dm_3, tau_m_2, sub_10, p_m_2, sum_4, f_m_2, mul_3, tau_lo_3, dm_4, tau_m_3, sub_12, p_m_3, sum_5, f_m_3, mul_4, tau_lo_4, dm_5, tau_m_4, sub_14, p_m_4, sum_6, f_m_4, mul_5, tau_lo_5, dm_6, tau_m_5, sub_16, p_m_5, sum_7, f_m_5, mul_6, tau_lo_6, dm_7, tau_m_6, sub_18, p_m_6, sum_8, f_m_6, mul_7, tau_lo_7, dm_8, tau_m_7, sub_20, p_m_7, sum_9, f_m_7, mul_8, tau_lo_8, dm_9, tau_m_8, sub_22, p_m_8, sum_10, f_m_8, mul_9, tau_lo_9, dm_10, tau_m_9, sub_24, p_m_9, sum_11, f_m_9, mul_10, tau_lo_10, dm_11, tau_m_10, sub_26, p_m_10, sum_12, f_m_10, mul_11, tau_lo_11, dm_12, tau_m_11, sub_28, p_m_11, sum_13, f_m_11, mul_12, tau_lo_12, dm_13, tau_m_12, sub_30, p_m_12, sum_14, f_m_12, mul_13, tau_lo_13, dm_14, tau_m_13, sub_32, p_m_13, sum_15, f_m_13, mul_14, tau_lo_14, dm_15, tau_m_14, sub_34, p_m_14, sum_16, f_m_14, mul_15, tau_lo_15, dm_16, tau_m_15, sub_36, p_m_15, sum_17, f_m_15, mul_16, tau_lo_16, dm_17, tau_m_16, sub_38, p_m_16, sum_18, f_m_16, mul_17, tau_lo_17], Original ATen: [aten.max, aten.sub, aten.div, aten.add, aten.clamp, aten.sum, aten.mul, aten.where]
# Source node to ATen node mapping:
#   clamp => clamp_min
#   dm => sub_5
#   dm_1 => div
#   dm_10 => div_9
#   dm_11 => div_10
#   dm_12 => div_11
#   dm_13 => div_12
#   dm_14 => div_13
#   dm_15 => div_14
#   dm_16 => div_15
#   dm_17 => div_16
#   dm_2 => div_1
#   dm_3 => div_2
#   dm_4 => div_3
#   dm_5 => div_4
#   dm_6 => div_5
#   dm_7 => div_6
#   dm_8 => div_7
#   dm_9 => div_8
#   f_lo => sub_4
#   f_m => sub_7
#   f_m_1 => sub_9
#   f_m_10 => sub_27
#   f_m_11 => sub_29
#   f_m_12 => sub_31
#   f_m_13 => sub_33
#   f_m_14 => sub_35
#   f_m_15 => sub_37
#   f_m_16 => sub_39
#   f_m_2 => sub_11
#   f_m_3 => sub_13
#   f_m_4 => sub_15
#   f_m_5 => sub_17
#   f_m_6 => sub_19
#   f_m_7 => sub_21
#   f_m_8 => sub_23
#   f_m_9 => sub_25
#   max_1 => max_1
#   mul_1 => mul_1
#   mul_10 => mul_10
#   mul_11 => mul_11
#   mul_12 => mul_12
#   mul_13 => mul_13
#   mul_14 => mul_14
#   mul_15 => mul_15
#   mul_16 => mul_16
#   mul_17 => mul_17
#   mul_2 => mul_2
#   mul_3 => mul_3
#   mul_4 => mul_4
#   mul_5 => mul_5
#   mul_6 => mul_6
#   mul_7 => mul_7
#   mul_8 => mul_8
#   mul_9 => mul_9
#   p_m => clamp_min_1
#   p_m_1 => clamp_min_2
#   p_m_10 => clamp_min_11
#   p_m_11 => clamp_min_12
#   p_m_12 => clamp_min_13
#   p_m_13 => clamp_min_14
#   p_m_14 => clamp_min_15
#   p_m_15 => clamp_min_16
#   p_m_16 => clamp_min_17
#   p_m_2 => clamp_min_3
#   p_m_3 => clamp_min_4
#   p_m_4 => clamp_min_5
#   p_m_5 => clamp_min_6
#   p_m_6 => clamp_min_7
#   p_m_7 => clamp_min_8
#   p_m_8 => clamp_min_9
#   p_m_9 => clamp_min_10
#   sub_10 => sub_10
#   sub_12 => sub_12
#   sub_14 => sub_14
#   sub_16 => sub_16
#   sub_18 => sub_18
#   sub_20 => sub_20
#   sub_22 => sub_22
#   sub_24 => sub_24
#   sub_26 => sub_26
#   sub_28 => sub_28
#   sub_3 => sub_3
#   sub_30 => sub_30
#   sub_32 => sub_32
#   sub_34 => sub_34
#   sub_36 => sub_36
#   sub_38 => sub_38
#   sub_6 => sub_6
#   sub_8 => sub_8
#   sum_1 => sum_1
#   sum_10 => sum_10
#   sum_11 => sum_11
#   sum_12 => sum_12
#   sum_13 => sum_13
#   sum_14 => sum_14
#   sum_15 => sum_15
#   sum_16 => sum_16
#   sum_17 => sum_17
#   sum_18 => sum_18
#   sum_2 => sum_2
#   sum_3 => sum_3
#   sum_4 => sum_4
#   sum_5 => sum_5
#   sum_6 => sum_6
#   sum_7 => sum_7
#   sum_8 => sum_8
#   sum_9 => sum_9
#   tau_hi => sub_2
#   tau_lo => sub_1
#   tau_lo_1 => where
#   tau_lo_10 => where_9
#   tau_lo_11 => where_10
#   tau_lo_12 => where_11
#   tau_lo_13 => where_12
#   tau_lo_14 => where_13
#   tau_lo_15 => where_14
#   tau_lo_16 => where_15
#   tau_lo_17 => where_16
#   tau_lo_2 => where_1
#   tau_lo_3 => where_2
#   tau_lo_4 => where_3
#   tau_lo_5 => where_4
#   tau_lo_6 => where_5
#   tau_lo_7 => where_6
#   tau_lo_8 => where_7
#   tau_lo_9 => where_8
#   tau_m => add
#   tau_m_1 => add_1
#   tau_m_10 => add_10
#   tau_m_11 => add_11
#   tau_m_12 => add_12
#   tau_m_13 => add_13
#   tau_m_14 => add_14
#   tau_m_15 => add_15
#   tau_m_16 => add_16
#   tau_m_2 => add_2
#   tau_m_3 => add_3
#   tau_m_4 => add_4
#   tau_m_5 => add_5
#   tau_m_6 => add_6
#   tau_m_7 => add_7
#   tau_m_8 => add_8
#   tau_m_9 => add_9
# Graph fragment:
#   %max_1 : [num_users=1] = call_function[target=torch.ops.aten.max.dim](args = (%arg0_1, -1, True), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 0.25), kwargs = {})
#   %sub_1 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 1), kwargs = {})
#   %sub_5 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub_2, %sub_1), kwargs = {})
#   %div : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%sub_5, 2), kwargs = {})
#   %add : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%sub_1, %div), kwargs = {})
#   %sub_6 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add), kwargs = {})
#   %clamp_min_1 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_6, 0), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_1, [-1]), kwargs = {})
#   %sub_7 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_2, 1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %sub_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min, [-1]), kwargs = {})
#   %sub_4 : [num_users=49] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_1, 1), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_7, %sub_4), kwargs = {})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze, %add, %sub_1), kwargs = {})
#   %div_1 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div, 2), kwargs = {})
#   %add_1 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where, %div_1), kwargs = {})
#   %sub_8 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_1), kwargs = {})
#   %clamp_min_2 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_8, 0), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_2, [-1]), kwargs = {})
#   %sub_9 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_3, 1), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_9, %sub_4), kwargs = {})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_1, %add_1, %where), kwargs = {})
#   %div_2 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_1, 2), kwargs = {})
#   %add_2 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_1, %div_2), kwargs = {})
#   %sub_10 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_2), kwargs = {})
#   %clamp_min_3 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_10, 0), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_3, [-1]), kwargs = {})
#   %sub_11 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_4, 1), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_11, %sub_4), kwargs = {})
#   %where_2 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_2, %add_2, %where_1), kwargs = {})
#   %div_3 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_2, 2), kwargs = {})
#   %add_3 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_2, %div_3), kwargs = {})
#   %sub_12 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_3), kwargs = {})
#   %clamp_min_4 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_12, 0), kwargs = {})
#   %sum_5 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_4, [-1]), kwargs = {})
#   %sub_13 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_5, 1), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_13, %sub_4), kwargs = {})
#   %where_3 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_3, %add_3, %where_2), kwargs = {})
#   %div_4 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_3, 2), kwargs = {})
#   %add_4 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_3, %div_4), kwargs = {})
#   %sub_14 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_4), kwargs = {})
#   %clamp_min_5 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_14, 0), kwargs = {})
#   %sum_6 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_5, [-1]), kwargs = {})
#   %sub_15 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_6, 1), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_15, %sub_4), kwargs = {})
#   %where_4 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_4, %add_4, %where_3), kwargs = {})
#   %div_5 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_4, 2), kwargs = {})
#   %add_5 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_4, %div_5), kwargs = {})
#   %sub_16 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_5), kwargs = {})
#   %clamp_min_6 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_16, 0), kwargs = {})
#   %sum_7 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_6, [-1]), kwargs = {})
#   %sub_17 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_7, 1), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_17, %sub_4), kwargs = {})
#   %where_5 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_5, %add_5, %where_4), kwargs = {})
#   %div_6 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_5, 2), kwargs = {})
#   %add_6 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_5, %div_6), kwargs = {})
#   %sub_18 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_6), kwargs = {})
#   %clamp_min_7 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_18, 0), kwargs = {})
#   %sum_8 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_7, [-1]), kwargs = {})
#   %sub_19 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_8, 1), kwargs = {})
#   %mul_7 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_19, %sub_4), kwargs = {})
#   %where_6 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_6, %add_6, %where_5), kwargs = {})
#   %div_7 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_6, 2), kwargs = {})
#   %add_7 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_6, %div_7), kwargs = {})
#   %sub_20 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_7), kwargs = {})
#   %clamp_min_8 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_20, 0), kwargs = {})
#   %sum_9 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_8, [-1]), kwargs = {})
#   %sub_21 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_9, 1), kwargs = {})
#   %mul_8 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_21, %sub_4), kwargs = {})
#   %where_7 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_7, %add_7, %where_6), kwargs = {})
#   %div_8 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_7, 2), kwargs = {})
#   %add_8 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_7, %div_8), kwargs = {})
#   %sub_22 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_8), kwargs = {})
#   %clamp_min_9 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_22, 0), kwargs = {})
#   %sum_10 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_9, [-1]), kwargs = {})
#   %sub_23 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_10, 1), kwargs = {})
#   %mul_9 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_23, %sub_4), kwargs = {})
#   %where_8 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_8, %add_8, %where_7), kwargs = {})
#   %div_9 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_8, 2), kwargs = {})
#   %add_9 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_8, %div_9), kwargs = {})
#   %sub_24 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_9), kwargs = {})
#   %clamp_min_10 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_24, 0), kwargs = {})
#   %sum_11 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_10, [-1]), kwargs = {})
#   %sub_25 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_11, 1), kwargs = {})
#   %mul_10 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_25, %sub_4), kwargs = {})
#   %where_9 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_9, %add_9, %where_8), kwargs = {})
#   %div_10 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_9, 2), kwargs = {})
#   %add_10 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_9, %div_10), kwargs = {})
#   %sub_26 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_10), kwargs = {})
#   %clamp_min_11 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_26, 0), kwargs = {})
#   %sum_12 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_11, [-1]), kwargs = {})
#   %sub_27 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_12, 1), kwargs = {})
#   %mul_11 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_27, %sub_4), kwargs = {})
#   %where_10 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_10, %add_10, %where_9), kwargs = {})
#   %div_11 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_10, 2), kwargs = {})
#   %add_11 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_10, %div_11), kwargs = {})
#   %sub_28 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_11), kwargs = {})
#   %clamp_min_12 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_28, 0), kwargs = {})
#   %sum_13 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_12, [-1]), kwargs = {})
#   %sub_29 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_13, 1), kwargs = {})
#   %mul_12 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_29, %sub_4), kwargs = {})
#   %where_11 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_11, %add_11, %where_10), kwargs = {})
#   %div_12 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_11, 2), kwargs = {})
#   %add_12 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_11, %div_12), kwargs = {})
#   %sub_30 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_12), kwargs = {})
#   %clamp_min_13 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_30, 0), kwargs = {})
#   %sum_14 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_13, [-1]), kwargs = {})
#   %sub_31 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_14, 1), kwargs = {})
#   %mul_13 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_31, %sub_4), kwargs = {})
#   %where_12 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_12, %add_12, %where_11), kwargs = {})
#   %div_13 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_12, 2), kwargs = {})
#   %add_13 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_12, %div_13), kwargs = {})
#   %sub_32 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_13), kwargs = {})
#   %clamp_min_14 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_32, 0), kwargs = {})
#   %sum_15 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_14, [-1]), kwargs = {})
#   %sub_33 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_15, 1), kwargs = {})
#   %mul_14 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_33, %sub_4), kwargs = {})
#   %where_13 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_13, %add_13, %where_12), kwargs = {})
#   %div_14 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_13, 2), kwargs = {})
#   %add_14 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_13, %div_14), kwargs = {})
#   %sub_34 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_14), kwargs = {})
#   %clamp_min_15 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_34, 0), kwargs = {})
#   %sum_16 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_15, [-1]), kwargs = {})
#   %sub_35 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_16, 1), kwargs = {})
#   %mul_15 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_35, %sub_4), kwargs = {})
#   %where_14 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_14, %add_14, %where_13), kwargs = {})
#   %div_15 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_14, 2), kwargs = {})
#   %add_15 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_14, %div_15), kwargs = {})
#   %sub_36 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_15), kwargs = {})
#   %clamp_min_16 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_36, 0), kwargs = {})
#   %sum_17 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_16, [-1]), kwargs = {})
#   %sub_37 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_17, 1), kwargs = {})
#   %mul_16 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_37, %sub_4), kwargs = {})
#   %where_15 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_15, %add_15, %where_14), kwargs = {})
#   %div_16 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_15, 2), kwargs = {})
#   %add_16 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_15, %div_16), kwargs = {})
#   %sub_38 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_16), kwargs = {})
#   %clamp_min_17 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_38, 0), kwargs = {})
#   %sum_18 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_17, [-1]), kwargs = {})
#   %sub_39 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_18, 1), kwargs = {})
#   %mul_17 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_39, %sub_4), kwargs = {})
#   %where_16 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_16, %add_16, %where_15), kwargs = {})
triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0 = async_compile.triton('triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0', 'mutated_arg_names': ['in_out_ptr8'], 'no_x_dim': False, 'num_load': 4, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0(in_out_ptr8, in_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp6 = triton_helpers.maximum(tmp4, tmp5)
    tmp7 = 1.0
    tmp8 = tmp6 - tmp7
    tmp9 = 0.25
    tmp10 = tmp6 - tmp9
    tmp11 = tmp10 - tmp8
    tmp12 = 0.5
    tmp13 = tmp11 * tmp12
    tmp14 = tmp8 + tmp13
    tmp15 = tmp0 - tmp14
    tmp16 = 0.0
    tmp17 = triton_helpers.maximum(tmp15, tmp16)
    tmp18 = tmp1 - tmp14
    tmp19 = triton_helpers.maximum(tmp18, tmp16)
    tmp20 = tmp17 + tmp19
    tmp21 = tmp3 - tmp14
    tmp22 = triton_helpers.maximum(tmp21, tmp16)
    tmp23 = tmp20 + tmp22
    tmp24 = tmp5 - tmp14
    tmp25 = triton_helpers.maximum(tmp24, tmp16)
    tmp26 = tmp23 + tmp25
    tmp27 = tmp26 - tmp7
    tmp28 = tmp0 - tmp8
    tmp29 = triton_helpers.maximum(tmp28, tmp16)
    tmp30 = tmp1 - tmp8
    tmp31 = triton_helpers.maximum(tmp30, tmp16)
    tmp32 = tmp29 + tmp31
    tmp33 = tmp3 - tmp8
    tmp34 = triton_helpers.maximum(tmp33, tmp16)
    tmp35 = tmp32 + tmp34
    tmp36 = tmp5 - tmp8
    tmp37 = triton_helpers.maximum(tmp36, tmp16)
    tmp38 = tmp35 + tmp37
    tmp39 = tmp38 - tmp7
    tmp40 = tmp27 * tmp39
    tmp41 = tmp40 >= tmp16
    tmp42 = tl.where(tmp41, tmp14, tmp8)
    tmp43 = tmp13 * tmp12
    tmp44 = tmp42 + tmp43
    tmp45 = tmp0 - tmp44
    tmp46 = triton_helpers.maximum(tmp45, tmp16)
    tmp47 = tmp1 - tmp44
    tmp48 = triton_helpers.maximum(tmp47, tmp16)
    tmp49 = tmp46 + tmp48
    tmp50 = tmp3 - tmp44
    tmp51 = triton_helpers.maximum(tmp50, tmp16)
    tmp52 = tmp49 + tmp51
    tmp53 = tmp5 - tmp44
    tmp54 = triton_helpers.maximum(tmp53, tmp16)
    tmp55 = tmp52 + tmp54
    tmp56 = tmp55 - tmp7
    tmp57 = tmp56 * tmp39
    tmp58 = tmp57 >= tmp16
    tmp59 = tl.where(tmp58, tmp44, tmp42)
    tmp60 = tmp43 * tmp12
    tmp61 = tmp59 + tmp60
    tmp62 = tmp0 - tmp61
    tmp63 = triton_helpers.maximum(tmp62, tmp16)
    tmp64 = tmp1 - tmp61
    tmp65 = triton_helpers.maximum(tmp64, tmp16)
    tmp66 = tmp63 + tmp65
    tmp67 = tmp3 - tmp61
    tmp68 = triton_helpers.maximum(tmp67, tmp16)
    tmp69 = tmp66 + tmp68
    tmp70 = tmp5 - tmp61
    tmp71 = triton_helpers.maximum(tmp70, tmp16)
    tmp72 = tmp69 + tmp71
    tmp73 = tmp72 - tmp7
    tmp74 = tmp73 * tmp39
    tmp75 = tmp74 >= tmp16
    tmp76 = tl.where(tmp75, tmp61, tmp59)
    tmp77 = tmp60 * tmp12
    tmp78 = tmp76 + tmp77
    tmp79 = tmp0 - tmp78
    tmp80 = triton_helpers.maximum(tmp79, tmp16)
    tmp81 = tmp1 - tmp78
    tmp82 = triton_helpers.maximum(tmp81, tmp16)
    tmp83 = tmp80 + tmp82
    tmp84 = tmp3 - tmp78
    tmp85 = triton_helpers.maximum(tmp84, tmp16)
    tmp86 = tmp83 + tmp85
    tmp87 = tmp5 - tmp78
    tmp88 = triton_helpers.maximum(tmp87, tmp16)
    tmp89 = tmp86 + tmp88
    tmp90 = tmp89 - tmp7
    tmp91 = tmp90 * tmp39
    tmp92 = tmp91 >= tmp16
    tmp93 = tl.where(tmp92, tmp78, tmp76)
    tmp94 = tmp77 * tmp12
    tmp95 = tmp93 + tmp94
    tmp96 = tmp0 - tmp95
    tmp97 = triton_helpers.maximum(tmp96, tmp16)
    tmp98 = tmp1 - tmp95
    tmp99 = triton_helpers.maximum(tmp98, tmp16)
    tmp100 = tmp97 + tmp99
    tmp101 = tmp3 - tmp95
    tmp102 = triton_helpers.maximum(tmp101, tmp16)
    tmp103 = tmp100 + tmp102
    tmp104 = tmp5 - tmp95
    tmp105 = triton_helpers.maximum(tmp104, tmp16)
    tmp106 = tmp103 + tmp105
    tmp107 = tmp106 - tmp7
    tmp108 = tmp107 * tmp39
    tmp109 = tmp108 >= tmp16
    tmp110 = tl.where(tmp109, tmp95, tmp93)
    tmp111 = tmp94 * tmp12
    tmp112 = tmp110 + tmp111
    tmp113 = tmp0 - tmp112
    tmp114 = triton_helpers.maximum(tmp113, tmp16)
    tmp115 = tmp1 - tmp112
    tmp116 = triton_helpers.maximum(tmp115, tmp16)
    tmp117 = tmp114 + tmp116
    tmp118 = tmp3 - tmp112
    tmp119 = triton_helpers.maximum(tmp118, tmp16)
    tmp120 = tmp117 + tmp119
    tmp121 = tmp5 - tmp112
    tmp122 = triton_helpers.maximum(tmp121, tmp16)
    tmp123 = tmp120 + tmp122
    tmp124 = tmp123 - tmp7
    tmp125 = tmp124 * tmp39
    tmp126 = tmp125 >= tmp16
    tmp127 = tl.where(tmp126, tmp112, tmp110)
    tmp128 = tmp111 * tmp12
    tmp129 = tmp127 + tmp128
    tmp130 = tmp0 - tmp129
    tmp131 = triton_helpers.maximum(tmp130, tmp16)
    tmp132 = tmp1 - tmp129
    tmp133 = triton_helpers.maximum(tmp132, tmp16)
    tmp134 = tmp131 + tmp133
    tmp135 = tmp3 - tmp129
    tmp136 = triton_helpers.maximum(tmp135, tmp16)
    tmp137 = tmp134 + tmp136
    tmp138 = tmp5 - tmp129
    tmp139 = triton_helpers.maximum(tmp138, tmp16)
    tmp140 = tmp137 + tmp139
    tmp141 = tmp140 - tmp7
    tmp142 = tmp141 * tmp39
    tmp143 = tmp142 >= tmp16
    tmp144 = tl.where(tmp143, tmp129, tmp127)
    tmp145 = tmp128 * tmp12
    tmp146 = tmp144 + tmp145
    tmp147 = tmp0 - tmp146
    tmp148 = triton_helpers.maximum(tmp147, tmp16)
    tmp149 = tmp1 - tmp146
    tmp150 = triton_helpers.maximum(tmp149, tmp16)
    tmp151 = tmp148 + tmp150
    tmp152 = tmp3 - tmp146
    tmp153 = triton_helpers.maximum(tmp152, tmp16)
    tmp154 = tmp151 + tmp153
    tmp155 = tmp5 - tmp146
    tmp156 = triton_helpers.maximum(tmp155, tmp16)
    tmp157 = tmp154 + tmp156
    tmp158 = tmp157 - tmp7
    tmp159 = tmp158 * tmp39
    tmp160 = tmp159 >= tmp16
    tmp161 = tl.where(tmp160, tmp146, tmp144)
    tmp162 = tmp145 * tmp12
    tmp163 = tmp161 + tmp162
    tmp164 = tmp0 - tmp163
    tmp165 = triton_helpers.maximum(tmp164, tmp16)
    tmp166 = tmp1 - tmp163
    tmp167 = triton_helpers.maximum(tmp166, tmp16)
    tmp168 = tmp165 + tmp167
    tmp169 = tmp3 - tmp163
    tmp170 = triton_helpers.maximum(tmp169, tmp16)
    tmp171 = tmp168 + tmp170
    tmp172 = tmp5 - tmp163
    tmp173 = triton_helpers.maximum(tmp172, tmp16)
    tmp174 = tmp171 + tmp173
    tmp175 = tmp174 - tmp7
    tmp176 = tmp175 * tmp39
    tmp177 = tmp176 >= tmp16
    tmp178 = tl.where(tmp177, tmp163, tmp161)
    tmp179 = tmp162 * tmp12
    tmp180 = tmp178 + tmp179
    tmp181 = tmp0 - tmp180
    tmp182 = triton_helpers.maximum(tmp181, tmp16)
    tmp183 = tmp1 - tmp180
    tmp184 = triton_helpers.maximum(tmp183, tmp16)
    tmp185 = tmp182 + tmp184
    tmp186 = tmp3 - tmp180
    tmp187 = triton_helpers.maximum(tmp186, tmp16)
    tmp188 = tmp185 + tmp187
    tmp189 = tmp5 - tmp180
    tmp190 = triton_helpers.maximum(tmp189, tmp16)
    tmp191 = tmp188 + tmp190
    tmp192 = tmp191 - tmp7
    tmp193 = tmp192 * tmp39
    tmp194 = tmp193 >= tmp16
    tmp195 = tl.where(tmp194, tmp180, tmp178)
    tmp196 = tmp179 * tmp12
    tmp197 = tmp195 + tmp196
    tmp198 = tmp0 - tmp197
    tmp199 = triton_helpers.maximum(tmp198, tmp16)
    tmp200 = tmp1 - tmp197
    tmp201 = triton_helpers.maximum(tmp200, tmp16)
    tmp202 = tmp199 + tmp201
    tmp203 = tmp3 - tmp197
    tmp204 = triton_helpers.maximum(tmp203, tmp16)
    tmp205 = tmp202 + tmp204
    tmp206 = tmp5 - tmp197
    tmp207 = triton_helpers.maximum(tmp206, tmp16)
    tmp208 = tmp205 + tmp207
    tmp209 = tmp208 - tmp7
    tmp210 = tmp209 * tmp39
    tmp211 = tmp210 >= tmp16
    tmp212 = tl.where(tmp211, tmp197, tmp195)
    tmp213 = tmp196 * tmp12
    tmp214 = tmp212 + tmp213
    tmp215 = tmp0 - tmp214
    tmp216 = triton_helpers.maximum(tmp215, tmp16)
    tmp217 = tmp1 - tmp214
    tmp218 = triton_helpers.maximum(tmp217, tmp16)
    tmp219 = tmp216 + tmp218
    tmp220 = tmp3 - tmp214
    tmp221 = triton_helpers.maximum(tmp220, tmp16)
    tmp222 = tmp219 + tmp221
    tmp223 = tmp5 - tmp214
    tmp224 = triton_helpers.maximum(tmp223, tmp16)
    tmp225 = tmp222 + tmp224
    tmp226 = tmp225 - tmp7
    tmp227 = tmp226 * tmp39
    tmp228 = tmp227 >= tmp16
    tmp229 = tl.where(tmp228, tmp214, tmp212)
    tmp230 = tmp213 * tmp12
    tmp231 = tmp229 + tmp230
    tmp232 = tmp0 - tmp231
    tmp233 = triton_helpers.maximum(tmp232, tmp16)
    tmp234 = tmp1 - tmp231
    tmp235 = triton_helpers.maximum(tmp234, tmp16)
    tmp236 = tmp233 + tmp235
    tmp237 = tmp3 - tmp231
    tmp238 = triton_helpers.maximum(tmp237, tmp16)
    tmp239 = tmp236 + tmp238
    tmp240 = tmp5 - tmp231
    tmp241 = triton_helpers.maximum(tmp240, tmp16)
    tmp242 = tmp239 + tmp241
    tmp243 = tmp242 - tmp7
    tmp244 = tmp243 * tmp39
    tmp245 = tmp244 >= tmp16
    tmp246 = tl.where(tmp245, tmp231, tmp229)
    tmp247 = tmp230 * tmp12
    tmp248 = tmp246 + tmp247
    tmp249 = tmp0 - tmp248
    tmp250 = triton_helpers.maximum(tmp249, tmp16)
    tmp251 = tmp1 - tmp248
    tmp252 = triton_helpers.maximum(tmp251, tmp16)
    tmp253 = tmp250 + tmp252
    tmp254 = tmp3 - tmp248
    tmp255 = triton_helpers.maximum(tmp254, tmp16)
    tmp256 = tmp253 + tmp255
    tmp257 = tmp5 - tmp248
    tmp258 = triton_helpers.maximum(tmp257, tmp16)
    tmp259 = tmp256 + tmp258
    tmp260 = tmp259 - tmp7
    tmp261 = tmp260 * tmp39
    tmp262 = tmp261 >= tmp16
    tmp263 = tl.where(tmp262, tmp248, tmp246)
    tmp264 = tmp247 * tmp12
    tmp265 = tmp263 + tmp264
    tmp266 = tmp0 - tmp265
    tmp267 = triton_helpers.maximum(tmp266, tmp16)
    tmp268 = tmp1 - tmp265
    tmp269 = triton_helpers.maximum(tmp268, tmp16)
    tmp270 = tmp267 + tmp269
    tmp271 = tmp3 - tmp265
    tmp272 = triton_helpers.maximum(tmp271, tmp16)
    tmp273 = tmp270 + tmp272
    tmp274 = tmp5 - tmp265
    tmp275 = triton_helpers.maximum(tmp274, tmp16)
    tmp276 = tmp273 + tmp275
    tmp277 = tmp276 - tmp7
    tmp278 = tmp277 * tmp39
    tmp279 = tmp278 >= tmp16
    tmp280 = tl.where(tmp279, tmp265, tmp263)
    tmp281 = tmp264 * tmp12
    tmp282 = tmp280 + tmp281
    tmp283 = tmp0 - tmp282
    tmp284 = triton_helpers.maximum(tmp283, tmp16)
    tmp285 = tmp1 - tmp282
    tmp286 = triton_helpers.maximum(tmp285, tmp16)
    tmp287 = tmp284 + tmp286
    tmp288 = tmp3 - tmp282
    tmp289 = triton_helpers.maximum(tmp288, tmp16)
    tmp290 = tmp287 + tmp289
    tmp291 = tmp5 - tmp282
    tmp292 = triton_helpers.maximum(tmp291, tmp16)
    tmp293 = tmp290 + tmp292
    tmp294 = tmp293 - tmp7
    tmp295 = tmp294 * tmp39
    tmp296 = tmp295 >= tmp16
    tmp297 = tl.where(tmp296, tmp282, tmp280)
    tmp298 = tmp281 * tmp12
    tmp299 = tmp297 + tmp298
    tmp300 = tmp0 - tmp299
    tmp301 = triton_helpers.maximum(tmp300, tmp16)
    tmp302 = tmp1 - tmp299
    tmp303 = triton_helpers.maximum(tmp302, tmp16)
    tmp304 = tmp301 + tmp303
    tmp305 = tmp3 - tmp299
    tmp306 = triton_helpers.maximum(tmp305, tmp16)
    tmp307 = tmp304 + tmp306
    tmp308 = tmp5 - tmp299
    tmp309 = triton_helpers.maximum(tmp308, tmp16)
    tmp310 = tmp307 + tmp309
    tmp311 = tmp310 - tmp7
    tmp312 = tmp311 * tmp39
    tmp313 = tmp312 >= tmp16
    tmp314 = tl.where(tmp313, tmp299, tmp297)
    tl.store(in_out_ptr8 + (x0), tmp314, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/av/cavd5cj3tg3vokgvnwac6qqbcheawux6j46atz5eq3ovasf7jkxk.py
# Topologically Sorted Source Nodes: [max_1, tau_hi, tau_lo, dm, dm_1, sub_3, clamp, sum_1, f_lo, dm_2, dm_3, dm_4, dm_5, dm_6, dm_7, dm_8, dm_9, dm_10, dm_11, dm_12, dm_13, dm_14, dm_15, dm_16, dm_17, dm_18, tau_m_17, sub_40, p_m_17, sum_19, f_m_17, mul_18, tau_lo_18, dm_19, tau_m_18, sub_42, p_m_18, sum_20, f_m_18, mul_19, tau_lo_19, dm_20, tau_m_19, sub_44, p_m_19, sum_21, f_m_19, tau_lo_20, dm_21, tau_m_20, sub_46, p_m_20, sum_22, f_m_20, mul_21, tau_lo_21, dm_22, tau_m_21, sub_48, p_m_21, sum_23, f_m_21, mul_22, tau_lo_22, dm_23, tau_m_22, sub_50, p_m_22, sum_24, tau_lo_23, dm_24, tau_m_23, sub_52, p_m_23, sum_25, f_m_23, mul_24, tau_lo_24, dm_25, tau_m_24, sub_54, p_m_24, sum_26, tau_lo_25, dm_26, tau_m_25, sub_56, p_m_25, sum_27, f_m_25, mul_26, tau_lo_26, dm_27, tau_m_26, sub_58, p_m_26, sum_28, tau_lo_27, dm_28, tau_m_27, sub_60, p_m_27, sum_29, f_m_27, tau_lo_28, dm_29, tau_m_28, sub_62, p_m_28, sum_30, tau_lo_29, dm_30, tau_m_29, sub_64, p_m_29, sum_31, tau_lo_30, dm_31, tau_m_30, sub_66, p_m_30, sum_32, tau_lo_31, dm_32, tau_m_31, sub_68, p_m_31, sum_33, tau_lo_32, dm_33, tau_m_32, sub_70, p_m_32, sum_34, tau_lo_33, dm_34, tau_m_33, sub_72, p_m_33, sum_35, tau_lo_34, dm_35, tau_m_34, sub_74, p_m_34, sum_36, tau_lo_35, dm_36, tau_m_35, sub_76, p_m_35, sum_37, tau_lo_36, dm_37, tau_m_36, sub_78, p_m_36, sum_38, tau_lo_37, dm_38, tau_m_37, sub_80, p_m_37, sum_39, tau_lo_38, dm_39, tau_m_38, sub_82, p_m_38, sum_40, tau_lo_39, dm_40, tau_m_39, sub_84, p_m_39, sum_41, tau_lo_40], Original ATen: [aten.max, aten.sub, aten.div, aten.clamp, aten.sum, aten.add, aten.mul, aten.where]
# Source node to ATen node mapping:
#   clamp => clamp_min
#   dm => sub_5
#   dm_1 => div
#   dm_10 => div_9
#   dm_11 => div_10
#   dm_12 => div_11
#   dm_13 => div_12
#   dm_14 => div_13
#   dm_15 => div_14
#   dm_16 => div_15
#   dm_17 => div_16
#   dm_18 => div_17
#   dm_19 => div_18
#   dm_2 => div_1
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_3 => div_2
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_4 => div_3
#   dm_40 => div_39
#   dm_5 => div_4
#   dm_6 => div_5
#   dm_7 => div_6
#   dm_8 => div_7
#   dm_9 => div_8
#   f_lo => sub_4
#   f_m_17 => sub_41
#   f_m_18 => sub_43
#   f_m_19 => sub_45
#   f_m_20 => sub_47
#   f_m_21 => sub_49
#   f_m_23 => sub_53
#   f_m_25 => sub_57
#   f_m_27 => sub_61
#   max_1 => max_1
#   mul_18 => mul_18
#   mul_19 => mul_19
#   mul_21 => mul_21
#   mul_22 => mul_22
#   mul_24 => mul_24
#   mul_26 => mul_26
#   p_m_17 => clamp_min_18
#   p_m_18 => clamp_min_19
#   p_m_19 => clamp_min_20
#   p_m_20 => clamp_min_21
#   p_m_21 => clamp_min_22
#   p_m_22 => clamp_min_23
#   p_m_23 => clamp_min_24
#   p_m_24 => clamp_min_25
#   p_m_25 => clamp_min_26
#   p_m_26 => clamp_min_27
#   p_m_27 => clamp_min_28
#   p_m_28 => clamp_min_29
#   p_m_29 => clamp_min_30
#   p_m_30 => clamp_min_31
#   p_m_31 => clamp_min_32
#   p_m_32 => clamp_min_33
#   p_m_33 => clamp_min_34
#   p_m_34 => clamp_min_35
#   p_m_35 => clamp_min_36
#   p_m_36 => clamp_min_37
#   p_m_37 => clamp_min_38
#   p_m_38 => clamp_min_39
#   p_m_39 => clamp_min_40
#   sub_3 => sub_3
#   sub_40 => sub_40
#   sub_42 => sub_42
#   sub_44 => sub_44
#   sub_46 => sub_46
#   sub_48 => sub_48
#   sub_50 => sub_50
#   sub_52 => sub_52
#   sub_54 => sub_54
#   sub_56 => sub_56
#   sub_58 => sub_58
#   sub_60 => sub_60
#   sub_62 => sub_62
#   sub_64 => sub_64
#   sub_66 => sub_66
#   sub_68 => sub_68
#   sub_70 => sub_70
#   sub_72 => sub_72
#   sub_74 => sub_74
#   sub_76 => sub_76
#   sub_78 => sub_78
#   sub_80 => sub_80
#   sub_82 => sub_82
#   sub_84 => sub_84
#   sum_1 => sum_1
#   sum_19 => sum_19
#   sum_20 => sum_20
#   sum_21 => sum_21
#   sum_22 => sum_22
#   sum_23 => sum_23
#   sum_24 => sum_24
#   sum_25 => sum_25
#   sum_26 => sum_26
#   sum_27 => sum_27
#   sum_28 => sum_28
#   sum_29 => sum_29
#   sum_30 => sum_30
#   sum_31 => sum_31
#   sum_32 => sum_32
#   sum_33 => sum_33
#   sum_34 => sum_34
#   sum_35 => sum_35
#   sum_36 => sum_36
#   sum_37 => sum_37
#   sum_38 => sum_38
#   sum_39 => sum_39
#   sum_40 => sum_40
#   sum_41 => sum_41
#   tau_hi => sub_2
#   tau_lo => sub_1
#   tau_lo_18 => where_17
#   tau_lo_19 => where_18
#   tau_lo_20 => where_19
#   tau_lo_21 => where_20
#   tau_lo_22 => where_21
#   tau_lo_23 => where_22
#   tau_lo_24 => where_23
#   tau_lo_25 => where_24
#   tau_lo_26 => where_25
#   tau_lo_27 => where_26
#   tau_lo_28 => where_27
#   tau_lo_29 => where_28
#   tau_lo_30 => where_29
#   tau_lo_31 => where_30
#   tau_lo_32 => where_31
#   tau_lo_33 => where_32
#   tau_lo_34 => where_33
#   tau_lo_35 => where_34
#   tau_lo_36 => where_35
#   tau_lo_37 => where_36
#   tau_lo_38 => where_37
#   tau_lo_39 => where_38
#   tau_lo_40 => where_39
#   tau_m_17 => add_17
#   tau_m_18 => add_18
#   tau_m_19 => add_19
#   tau_m_20 => add_20
#   tau_m_21 => add_21
#   tau_m_22 => add_22
#   tau_m_23 => add_23
#   tau_m_24 => add_24
#   tau_m_25 => add_25
#   tau_m_26 => add_26
#   tau_m_27 => add_27
#   tau_m_28 => add_28
#   tau_m_29 => add_29
#   tau_m_30 => add_30
#   tau_m_31 => add_31
#   tau_m_32 => add_32
#   tau_m_33 => add_33
#   tau_m_34 => add_34
#   tau_m_35 => add_35
#   tau_m_36 => add_36
#   tau_m_37 => add_37
#   tau_m_38 => add_38
#   tau_m_39 => add_39
# Graph fragment:
#   %max_1 : [num_users=1] = call_function[target=torch.ops.aten.max.dim](args = (%arg0_1, -1, True), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 0.25), kwargs = {})
#   %sub_1 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 1), kwargs = {})
#   %sub_5 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub_2, %sub_1), kwargs = {})
#   %div : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%sub_5, 2), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %sub_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min, [-1]), kwargs = {})
#   %sub_4 : [num_users=49] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_1, 1), kwargs = {})
#   %div_1 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div, 2), kwargs = {})
#   %div_2 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_1, 2), kwargs = {})
#   %div_3 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_2, 2), kwargs = {})
#   %div_4 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_3, 2), kwargs = {})
#   %div_5 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_4, 2), kwargs = {})
#   %div_6 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_5, 2), kwargs = {})
#   %div_7 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_6, 2), kwargs = {})
#   %div_8 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_7, 2), kwargs = {})
#   %div_9 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_8, 2), kwargs = {})
#   %div_10 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_9, 2), kwargs = {})
#   %div_11 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_10, 2), kwargs = {})
#   %div_12 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_11, 2), kwargs = {})
#   %div_13 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_12, 2), kwargs = {})
#   %div_14 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_13, 2), kwargs = {})
#   %div_15 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_14, 2), kwargs = {})
#   %div_16 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_15, 2), kwargs = {})
#   %div_17 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_16, 2), kwargs = {})
#   %add_17 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_16, %div_17), kwargs = {})
#   %sub_40 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_17), kwargs = {})
#   %clamp_min_18 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_40, 0), kwargs = {})
#   %sum_19 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_18, [-1]), kwargs = {})
#   %sub_41 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_19, 1), kwargs = {})
#   %mul_18 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_41, %sub_4), kwargs = {})
#   %where_17 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_17, %add_17, %where_16), kwargs = {})
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %add_18 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_17, %div_18), kwargs = {})
#   %sub_42 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_18), kwargs = {})
#   %clamp_min_19 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_42, 0), kwargs = {})
#   %sum_20 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_19, [-1]), kwargs = {})
#   %sub_43 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_20, 1), kwargs = {})
#   %mul_19 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_43, %sub_4), kwargs = {})
#   %where_18 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_18, %add_18, %where_17), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %add_19 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_18, %div_19), kwargs = {})
#   %sub_44 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_19), kwargs = {})
#   %clamp_min_20 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_44, 0), kwargs = {})
#   %sum_21 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_20, [-1]), kwargs = {})
#   %sub_45 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_21, 1), kwargs = {})
#   %where_19 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_19, %add_19, %where_18), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %add_20 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_19, %div_20), kwargs = {})
#   %sub_46 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_20), kwargs = {})
#   %clamp_min_21 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_46, 0), kwargs = {})
#   %sum_22 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_21, [-1]), kwargs = {})
#   %sub_47 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_22, 1), kwargs = {})
#   %mul_21 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_47, %sub_4), kwargs = {})
#   %where_20 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_20, %add_20, %where_19), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %add_21 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_20, %div_21), kwargs = {})
#   %sub_48 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_21), kwargs = {})
#   %clamp_min_22 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_48, 0), kwargs = {})
#   %sum_23 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_22, [-1]), kwargs = {})
#   %sub_49 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_23, 1), kwargs = {})
#   %mul_22 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_49, %sub_4), kwargs = {})
#   %where_21 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_21, %add_21, %where_20), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %add_22 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_21, %div_22), kwargs = {})
#   %sub_50 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_22), kwargs = {})
#   %clamp_min_23 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_50, 0), kwargs = {})
#   %sum_24 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_23, [-1]), kwargs = {})
#   %where_22 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_22, %add_22, %where_21), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %add_23 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_22, %div_23), kwargs = {})
#   %sub_52 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_23), kwargs = {})
#   %clamp_min_24 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_52, 0), kwargs = {})
#   %sum_25 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_24, [-1]), kwargs = {})
#   %sub_53 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_25, 1), kwargs = {})
#   %mul_24 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_53, %sub_4), kwargs = {})
#   %where_23 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_23, %add_23, %where_22), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %add_24 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_23, %div_24), kwargs = {})
#   %sub_54 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_24), kwargs = {})
#   %clamp_min_25 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_54, 0), kwargs = {})
#   %sum_26 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_25, [-1]), kwargs = {})
#   %where_24 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_24, %add_24, %where_23), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %add_25 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_24, %div_25), kwargs = {})
#   %sub_56 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_25), kwargs = {})
#   %clamp_min_26 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_56, 0), kwargs = {})
#   %sum_27 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_26, [-1]), kwargs = {})
#   %sub_57 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_27, 1), kwargs = {})
#   %mul_26 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_57, %sub_4), kwargs = {})
#   %where_25 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_25, %add_25, %where_24), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %add_26 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_25, %div_26), kwargs = {})
#   %sub_58 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_26), kwargs = {})
#   %clamp_min_27 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_58, 0), kwargs = {})
#   %sum_28 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_27, [-1]), kwargs = {})
#   %where_26 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_26, %add_26, %where_25), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %add_27 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_26, %div_27), kwargs = {})
#   %sub_60 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_27), kwargs = {})
#   %clamp_min_28 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_60, 0), kwargs = {})
#   %sum_29 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_28, [-1]), kwargs = {})
#   %sub_61 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_29, 1), kwargs = {})
#   %where_27 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_27, %add_27, %where_26), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %add_28 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_27, %div_28), kwargs = {})
#   %sub_62 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_28), kwargs = {})
#   %clamp_min_29 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_62, 0), kwargs = {})
#   %sum_30 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_29, [-1]), kwargs = {})
#   %where_28 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_28, %add_28, %where_27), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %add_29 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_28, %div_29), kwargs = {})
#   %sub_64 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_29), kwargs = {})
#   %clamp_min_30 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_64, 0), kwargs = {})
#   %sum_31 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_30, [-1]), kwargs = {})
#   %where_29 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_29, %add_29, %where_28), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %add_30 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_29, %div_30), kwargs = {})
#   %sub_66 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_30), kwargs = {})
#   %clamp_min_31 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_66, 0), kwargs = {})
#   %sum_32 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_31, [-1]), kwargs = {})
#   %where_30 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_30, %add_30, %where_29), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %add_31 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_30, %div_31), kwargs = {})
#   %sub_68 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_31), kwargs = {})
#   %clamp_min_32 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_68, 0), kwargs = {})
#   %sum_33 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_32, [-1]), kwargs = {})
#   %where_31 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_31, %add_31, %where_30), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %add_32 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_31, %div_32), kwargs = {})
#   %sub_70 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_32), kwargs = {})
#   %clamp_min_33 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_70, 0), kwargs = {})
#   %sum_34 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_33, [-1]), kwargs = {})
#   %where_32 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_32, %add_32, %where_31), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %add_33 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_32, %div_33), kwargs = {})
#   %sub_72 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_33), kwargs = {})
#   %clamp_min_34 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_72, 0), kwargs = {})
#   %sum_35 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_34, [-1]), kwargs = {})
#   %where_33 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_33, %add_33, %where_32), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %add_34 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_33, %div_34), kwargs = {})
#   %sub_74 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_34), kwargs = {})
#   %clamp_min_35 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_74, 0), kwargs = {})
#   %sum_36 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_35, [-1]), kwargs = {})
#   %where_34 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_34, %add_34, %where_33), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %add_35 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_34, %div_35), kwargs = {})
#   %sub_76 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_35), kwargs = {})
#   %clamp_min_36 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_76, 0), kwargs = {})
#   %sum_37 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_36, [-1]), kwargs = {})
#   %where_35 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_35, %add_35, %where_34), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %add_36 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_35, %div_36), kwargs = {})
#   %sub_78 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_36), kwargs = {})
#   %clamp_min_37 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_78, 0), kwargs = {})
#   %sum_38 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_37, [-1]), kwargs = {})
#   %where_36 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_36, %add_36, %where_35), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %add_37 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_36, %div_37), kwargs = {})
#   %sub_80 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_37), kwargs = {})
#   %clamp_min_38 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_80, 0), kwargs = {})
#   %sum_39 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_38, [-1]), kwargs = {})
#   %where_37 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_37, %add_37, %where_36), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %add_38 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_37, %div_38), kwargs = {})
#   %sub_82 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_38), kwargs = {})
#   %clamp_min_39 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_82, 0), kwargs = {})
#   %sum_40 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_39, [-1]), kwargs = {})
#   %where_38 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_38, %add_38, %where_37), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %add_39 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_38, %div_39), kwargs = {})
#   %sub_84 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_39), kwargs = {})
#   %clamp_min_40 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_84, 0), kwargs = {})
#   %sum_41 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_40, [-1]), kwargs = {})
#   %where_39 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_39, %add_39, %where_38), kwargs = {})
triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1 = async_compile.triton('triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1', 'mutated_arg_names': ['in_out_ptr16'], 'no_x_dim': False, 'num_load': 5, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1(in_out_ptr16, in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr1 + (x0), xmask)
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp6 = triton_helpers.maximum(tmp4, tmp5)
    tmp7 = 0.25
    tmp8 = tmp6 - tmp7
    tmp9 = 1.0
    tmp10 = tmp6 - tmp9
    tmp11 = tmp8 - tmp10
    tmp12 = 0.5
    tmp13 = tmp11 * tmp12
    tmp14 = tmp13 * tmp12
    tmp15 = tmp14 * tmp12
    tmp16 = tmp15 * tmp12
    tmp17 = tmp16 * tmp12
    tmp18 = tmp17 * tmp12
    tmp19 = tmp18 * tmp12
    tmp20 = tmp19 * tmp12
    tmp21 = tmp20 * tmp12
    tmp22 = tmp21 * tmp12
    tmp23 = tmp22 * tmp12
    tmp24 = tmp23 * tmp12
    tmp25 = tmp24 * tmp12
    tmp26 = tmp25 * tmp12
    tmp27 = tmp26 * tmp12
    tmp28 = tmp27 * tmp12
    tmp29 = tmp28 * tmp12
    tmp30 = tmp29 * tmp12
    tmp32 = tmp31 + tmp30
    tmp33 = tmp0 - tmp32
    tmp34 = 0.0
    tmp35 = triton_helpers.maximum(tmp33, tmp34)
    tmp36 = tmp1 - tmp32
    tmp37 = triton_helpers.maximum(tmp36, tmp34)
    tmp38 = tmp35 + tmp37
    tmp39 = tmp3 - tmp32
    tmp40 = triton_helpers.maximum(tmp39, tmp34)
    tmp41 = tmp38 + tmp40
    tmp42 = tmp5 - tmp32
    tmp43 = triton_helpers.maximum(tmp42, tmp34)
    tmp44 = tmp41 + tmp43
    tmp45 = tmp44 - tmp9
    tmp46 = tmp0 - tmp10
    tmp47 = triton_helpers.maximum(tmp46, tmp34)
    tmp48 = tmp1 - tmp10
    tmp49 = triton_helpers.maximum(tmp48, tmp34)
    tmp50 = tmp47 + tmp49
    tmp51 = tmp3 - tmp10
    tmp52 = triton_helpers.maximum(tmp51, tmp34)
    tmp53 = tmp50 + tmp52
    tmp54 = tmp5 - tmp10
    tmp55 = triton_helpers.maximum(tmp54, tmp34)
    tmp56 = tmp53 + tmp55
    tmp57 = tmp56 - tmp9
    tmp58 = tmp45 * tmp57
    tmp59 = tmp58 >= tmp34
    tmp60 = tl.where(tmp59, tmp32, tmp31)
    tmp61 = tmp30 * tmp12
    tmp62 = tmp60 + tmp61
    tmp63 = tmp0 - tmp62
    tmp64 = triton_helpers.maximum(tmp63, tmp34)
    tmp65 = tmp1 - tmp62
    tmp66 = triton_helpers.maximum(tmp65, tmp34)
    tmp67 = tmp64 + tmp66
    tmp68 = tmp3 - tmp62
    tmp69 = triton_helpers.maximum(tmp68, tmp34)
    tmp70 = tmp67 + tmp69
    tmp71 = tmp5 - tmp62
    tmp72 = triton_helpers.maximum(tmp71, tmp34)
    tmp73 = tmp70 + tmp72
    tmp74 = tmp73 - tmp9
    tmp75 = tmp74 * tmp57
    tmp76 = tmp75 >= tmp34
    tmp77 = tl.where(tmp76, tmp62, tmp60)
    tmp78 = tmp61 * tmp12
    tmp79 = tmp77 + tmp78
    tmp80 = tmp0 - tmp79
    tmp81 = triton_helpers.maximum(tmp80, tmp34)
    tmp82 = tmp1 - tmp79
    tmp83 = triton_helpers.maximum(tmp82, tmp34)
    tmp84 = tmp81 + tmp83
    tmp85 = tmp3 - tmp79
    tmp86 = triton_helpers.maximum(tmp85, tmp34)
    tmp87 = tmp84 + tmp86
    tmp88 = tmp5 - tmp79
    tmp89 = triton_helpers.maximum(tmp88, tmp34)
    tmp90 = tmp87 + tmp89
    tmp91 = tmp90 - tmp9
    tmp92 = tmp91 * tmp57
    tmp93 = tmp92 >= tmp34
    tmp94 = tl.where(tmp93, tmp79, tmp77)
    tmp95 = tmp78 * tmp12
    tmp96 = tmp94 + tmp95
    tmp97 = tmp0 - tmp96
    tmp98 = triton_helpers.maximum(tmp97, tmp34)
    tmp99 = tmp1 - tmp96
    tmp100 = triton_helpers.maximum(tmp99, tmp34)
    tmp101 = tmp98 + tmp100
    tmp102 = tmp3 - tmp96
    tmp103 = triton_helpers.maximum(tmp102, tmp34)
    tmp104 = tmp101 + tmp103
    tmp105 = tmp5 - tmp96
    tmp106 = triton_helpers.maximum(tmp105, tmp34)
    tmp107 = tmp104 + tmp106
    tmp108 = tmp107 - tmp9
    tmp109 = tmp108 * tmp57
    tmp110 = tmp109 >= tmp34
    tmp111 = tl.where(tmp110, tmp96, tmp94)
    tmp112 = tmp95 * tmp12
    tmp113 = tmp111 + tmp112
    tmp114 = tmp0 - tmp113
    tmp115 = triton_helpers.maximum(tmp114, tmp34)
    tmp116 = tmp1 - tmp113
    tmp117 = triton_helpers.maximum(tmp116, tmp34)
    tmp118 = tmp115 + tmp117
    tmp119 = tmp3 - tmp113
    tmp120 = triton_helpers.maximum(tmp119, tmp34)
    tmp121 = tmp118 + tmp120
    tmp122 = tmp5 - tmp113
    tmp123 = triton_helpers.maximum(tmp122, tmp34)
    tmp124 = tmp121 + tmp123
    tmp125 = tmp124 - tmp9
    tmp126 = tmp125 * tmp57
    tmp127 = tmp126 >= tmp34
    tmp128 = tl.where(tmp127, tmp113, tmp111)
    tmp129 = tmp112 * tmp12
    tmp130 = tmp128 + tmp129
    tmp131 = tmp0 - tmp130
    tmp132 = triton_helpers.maximum(tmp131, tmp34)
    tmp133 = tmp1 - tmp130
    tmp134 = triton_helpers.maximum(tmp133, tmp34)
    tmp135 = tmp132 + tmp134
    tmp136 = tmp3 - tmp130
    tmp137 = triton_helpers.maximum(tmp136, tmp34)
    tmp138 = tmp135 + tmp137
    tmp139 = tmp5 - tmp130
    tmp140 = triton_helpers.maximum(tmp139, tmp34)
    tmp141 = tmp138 + tmp140
    tmp142 = tmp141 - tmp9
    tmp143 = tmp142 * tmp57
    tmp144 = tmp143 >= tmp34
    tmp145 = tl.where(tmp144, tmp130, tmp128)
    tmp146 = tmp129 * tmp12
    tmp147 = tmp145 + tmp146
    tmp148 = tmp0 - tmp147
    tmp149 = triton_helpers.maximum(tmp148, tmp34)
    tmp150 = tmp1 - tmp147
    tmp151 = triton_helpers.maximum(tmp150, tmp34)
    tmp152 = tmp149 + tmp151
    tmp153 = tmp3 - tmp147
    tmp154 = triton_helpers.maximum(tmp153, tmp34)
    tmp155 = tmp152 + tmp154
    tmp156 = tmp5 - tmp147
    tmp157 = triton_helpers.maximum(tmp156, tmp34)
    tmp158 = tmp155 + tmp157
    tmp159 = tmp158 - tmp9
    tmp160 = tmp159 * tmp57
    tmp161 = tmp160 >= tmp34
    tmp162 = tl.where(tmp161, tmp147, tmp145)
    tmp163 = tmp146 * tmp12
    tmp164 = tmp162 + tmp163
    tmp165 = tmp0 - tmp164
    tmp166 = triton_helpers.maximum(tmp165, tmp34)
    tmp167 = tmp1 - tmp164
    tmp168 = triton_helpers.maximum(tmp167, tmp34)
    tmp169 = tmp166 + tmp168
    tmp170 = tmp3 - tmp164
    tmp171 = triton_helpers.maximum(tmp170, tmp34)
    tmp172 = tmp169 + tmp171
    tmp173 = tmp5 - tmp164
    tmp174 = triton_helpers.maximum(tmp173, tmp34)
    tmp175 = tmp172 + tmp174
    tmp176 = tmp175 - tmp9
    tmp177 = tmp176 * tmp57
    tmp178 = tmp177 >= tmp34
    tmp179 = tl.where(tmp178, tmp164, tmp162)
    tmp180 = tmp163 * tmp12
    tmp181 = tmp179 + tmp180
    tmp182 = tmp0 - tmp181
    tmp183 = triton_helpers.maximum(tmp182, tmp34)
    tmp184 = tmp1 - tmp181
    tmp185 = triton_helpers.maximum(tmp184, tmp34)
    tmp186 = tmp183 + tmp185
    tmp187 = tmp3 - tmp181
    tmp188 = triton_helpers.maximum(tmp187, tmp34)
    tmp189 = tmp186 + tmp188
    tmp190 = tmp5 - tmp181
    tmp191 = triton_helpers.maximum(tmp190, tmp34)
    tmp192 = tmp189 + tmp191
    tmp193 = tmp192 - tmp9
    tmp194 = tmp193 * tmp57
    tmp195 = tmp194 >= tmp34
    tmp196 = tl.where(tmp195, tmp181, tmp179)
    tmp197 = tmp180 * tmp12
    tmp198 = tmp196 + tmp197
    tmp199 = tmp0 - tmp198
    tmp200 = triton_helpers.maximum(tmp199, tmp34)
    tmp201 = tmp1 - tmp198
    tmp202 = triton_helpers.maximum(tmp201, tmp34)
    tmp203 = tmp200 + tmp202
    tmp204 = tmp3 - tmp198
    tmp205 = triton_helpers.maximum(tmp204, tmp34)
    tmp206 = tmp203 + tmp205
    tmp207 = tmp5 - tmp198
    tmp208 = triton_helpers.maximum(tmp207, tmp34)
    tmp209 = tmp206 + tmp208
    tmp210 = tmp209 - tmp9
    tmp211 = tmp210 * tmp57
    tmp212 = tmp211 >= tmp34
    tmp213 = tl.where(tmp212, tmp198, tmp196)
    tmp214 = tmp197 * tmp12
    tmp215 = tmp213 + tmp214
    tmp216 = tmp0 - tmp215
    tmp217 = triton_helpers.maximum(tmp216, tmp34)
    tmp218 = tmp1 - tmp215
    tmp219 = triton_helpers.maximum(tmp218, tmp34)
    tmp220 = tmp217 + tmp219
    tmp221 = tmp3 - tmp215
    tmp222 = triton_helpers.maximum(tmp221, tmp34)
    tmp223 = tmp220 + tmp222
    tmp224 = tmp5 - tmp215
    tmp225 = triton_helpers.maximum(tmp224, tmp34)
    tmp226 = tmp223 + tmp225
    tmp227 = tmp226 - tmp9
    tmp228 = tmp227 * tmp57
    tmp229 = tmp228 >= tmp34
    tmp230 = tl.where(tmp229, tmp215, tmp213)
    tmp231 = tmp214 * tmp12
    tmp232 = tmp230 + tmp231
    tmp233 = tmp0 - tmp232
    tmp234 = triton_helpers.maximum(tmp233, tmp34)
    tmp235 = tmp1 - tmp232
    tmp236 = triton_helpers.maximum(tmp235, tmp34)
    tmp237 = tmp234 + tmp236
    tmp238 = tmp3 - tmp232
    tmp239 = triton_helpers.maximum(tmp238, tmp34)
    tmp240 = tmp237 + tmp239
    tmp241 = tmp5 - tmp232
    tmp242 = triton_helpers.maximum(tmp241, tmp34)
    tmp243 = tmp240 + tmp242
    tmp244 = tmp243 - tmp9
    tmp245 = tmp244 * tmp57
    tmp246 = tmp245 >= tmp34
    tmp247 = tl.where(tmp246, tmp232, tmp230)
    tmp248 = tmp231 * tmp12
    tmp249 = tmp247 + tmp248
    tmp250 = tmp0 - tmp249
    tmp251 = triton_helpers.maximum(tmp250, tmp34)
    tmp252 = tmp1 - tmp249
    tmp253 = triton_helpers.maximum(tmp252, tmp34)
    tmp254 = tmp251 + tmp253
    tmp255 = tmp3 - tmp249
    tmp256 = triton_helpers.maximum(tmp255, tmp34)
    tmp257 = tmp254 + tmp256
    tmp258 = tmp5 - tmp249
    tmp259 = triton_helpers.maximum(tmp258, tmp34)
    tmp260 = tmp257 + tmp259
    tmp261 = tmp260 - tmp9
    tmp262 = tmp261 * tmp57
    tmp263 = tmp262 >= tmp34
    tmp264 = tl.where(tmp263, tmp249, tmp247)
    tmp265 = tmp248 * tmp12
    tmp266 = tmp264 + tmp265
    tmp267 = tmp0 - tmp266
    tmp268 = triton_helpers.maximum(tmp267, tmp34)
    tmp269 = tmp1 - tmp266
    tmp270 = triton_helpers.maximum(tmp269, tmp34)
    tmp271 = tmp268 + tmp270
    tmp272 = tmp3 - tmp266
    tmp273 = triton_helpers.maximum(tmp272, tmp34)
    tmp274 = tmp271 + tmp273
    tmp275 = tmp5 - tmp266
    tmp276 = triton_helpers.maximum(tmp275, tmp34)
    tmp277 = tmp274 + tmp276
    tmp278 = tmp277 - tmp9
    tmp279 = tmp278 * tmp57
    tmp280 = tmp279 >= tmp34
    tmp281 = tl.where(tmp280, tmp266, tmp264)
    tmp282 = tmp265 * tmp12
    tmp283 = tmp281 + tmp282
    tmp284 = tmp0 - tmp283
    tmp285 = triton_helpers.maximum(tmp284, tmp34)
    tmp286 = tmp1 - tmp283
    tmp287 = triton_helpers.maximum(tmp286, tmp34)
    tmp288 = tmp285 + tmp287
    tmp289 = tmp3 - tmp283
    tmp290 = triton_helpers.maximum(tmp289, tmp34)
    tmp291 = tmp288 + tmp290
    tmp292 = tmp5 - tmp283
    tmp293 = triton_helpers.maximum(tmp292, tmp34)
    tmp294 = tmp291 + tmp293
    tmp295 = tmp294 - tmp9
    tmp296 = tmp295 * tmp57
    tmp297 = tmp296 >= tmp34
    tmp298 = tl.where(tmp297, tmp283, tmp281)
    tmp299 = tmp282 * tmp12
    tmp300 = tmp298 + tmp299
    tmp301 = tmp0 - tmp300
    tmp302 = triton_helpers.maximum(tmp301, tmp34)
    tmp303 = tmp1 - tmp300
    tmp304 = triton_helpers.maximum(tmp303, tmp34)
    tmp305 = tmp302 + tmp304
    tmp306 = tmp3 - tmp300
    tmp307 = triton_helpers.maximum(tmp306, tmp34)
    tmp308 = tmp305 + tmp307
    tmp309 = tmp5 - tmp300
    tmp310 = triton_helpers.maximum(tmp309, tmp34)
    tmp311 = tmp308 + tmp310
    tmp312 = tmp311 - tmp9
    tmp313 = tmp312 * tmp57
    tmp314 = tmp313 >= tmp34
    tmp315 = tl.where(tmp314, tmp300, tmp298)
    tmp316 = tmp299 * tmp12
    tmp317 = tmp315 + tmp316
    tmp318 = tmp0 - tmp317
    tmp319 = triton_helpers.maximum(tmp318, tmp34)
    tmp320 = tmp1 - tmp317
    tmp321 = triton_helpers.maximum(tmp320, tmp34)
    tmp322 = tmp319 + tmp321
    tmp323 = tmp3 - tmp317
    tmp324 = triton_helpers.maximum(tmp323, tmp34)
    tmp325 = tmp322 + tmp324
    tmp326 = tmp5 - tmp317
    tmp327 = triton_helpers.maximum(tmp326, tmp34)
    tmp328 = tmp325 + tmp327
    tmp329 = tmp328 - tmp9
    tmp330 = tmp329 * tmp57
    tmp331 = tmp330 >= tmp34
    tmp332 = tl.where(tmp331, tmp317, tmp315)
    tmp333 = tmp316 * tmp12
    tmp334 = tmp332 + tmp333
    tmp335 = tmp0 - tmp334
    tmp336 = triton_helpers.maximum(tmp335, tmp34)
    tmp337 = tmp1 - tmp334
    tmp338 = triton_helpers.maximum(tmp337, tmp34)
    tmp339 = tmp336 + tmp338
    tmp340 = tmp3 - tmp334
    tmp341 = triton_helpers.maximum(tmp340, tmp34)
    tmp342 = tmp339 + tmp341
    tmp343 = tmp5 - tmp334
    tmp344 = triton_helpers.maximum(tmp343, tmp34)
    tmp345 = tmp342 + tmp344
    tmp346 = tmp345 - tmp9
    tmp347 = tmp346 * tmp57
    tmp348 = tmp347 >= tmp34
    tmp349 = tl.where(tmp348, tmp334, tmp332)
    tmp350 = tmp333 * tmp12
    tmp351 = tmp349 + tmp350
    tmp352 = tmp0 - tmp351
    tmp353 = triton_helpers.maximum(tmp352, tmp34)
    tmp354 = tmp1 - tmp351
    tmp355 = triton_helpers.maximum(tmp354, tmp34)
    tmp356 = tmp353 + tmp355
    tmp357 = tmp3 - tmp351
    tmp358 = triton_helpers.maximum(tmp357, tmp34)
    tmp359 = tmp356 + tmp358
    tmp360 = tmp5 - tmp351
    tmp361 = triton_helpers.maximum(tmp360, tmp34)
    tmp362 = tmp359 + tmp361
    tmp363 = tmp362 - tmp9
    tmp364 = tmp363 * tmp57
    tmp365 = tmp364 >= tmp34
    tmp366 = tl.where(tmp365, tmp351, tmp349)
    tmp367 = tmp350 * tmp12
    tmp368 = tmp366 + tmp367
    tmp369 = tmp0 - tmp368
    tmp370 = triton_helpers.maximum(tmp369, tmp34)
    tmp371 = tmp1 - tmp368
    tmp372 = triton_helpers.maximum(tmp371, tmp34)
    tmp373 = tmp370 + tmp372
    tmp374 = tmp3 - tmp368
    tmp375 = triton_helpers.maximum(tmp374, tmp34)
    tmp376 = tmp373 + tmp375
    tmp377 = tmp5 - tmp368
    tmp378 = triton_helpers.maximum(tmp377, tmp34)
    tmp379 = tmp376 + tmp378
    tmp380 = tmp379 - tmp9
    tmp381 = tmp380 * tmp57
    tmp382 = tmp381 >= tmp34
    tmp383 = tl.where(tmp382, tmp368, tmp366)
    tmp384 = tmp367 * tmp12
    tmp385 = tmp383 + tmp384
    tmp386 = tmp0 - tmp385
    tmp387 = triton_helpers.maximum(tmp386, tmp34)
    tmp388 = tmp1 - tmp385
    tmp389 = triton_helpers.maximum(tmp388, tmp34)
    tmp390 = tmp387 + tmp389
    tmp391 = tmp3 - tmp385
    tmp392 = triton_helpers.maximum(tmp391, tmp34)
    tmp393 = tmp390 + tmp392
    tmp394 = tmp5 - tmp385
    tmp395 = triton_helpers.maximum(tmp394, tmp34)
    tmp396 = tmp393 + tmp395
    tmp397 = tmp396 - tmp9
    tmp398 = tmp397 * tmp57
    tmp399 = tmp398 >= tmp34
    tmp400 = tl.where(tmp399, tmp385, tmp383)
    tmp401 = tmp384 * tmp12
    tmp402 = tmp400 + tmp401
    tmp403 = tmp0 - tmp402
    tmp404 = triton_helpers.maximum(tmp403, tmp34)
    tmp405 = tmp1 - tmp402
    tmp406 = triton_helpers.maximum(tmp405, tmp34)
    tmp407 = tmp404 + tmp406
    tmp408 = tmp3 - tmp402
    tmp409 = triton_helpers.maximum(tmp408, tmp34)
    tmp410 = tmp407 + tmp409
    tmp411 = tmp5 - tmp402
    tmp412 = triton_helpers.maximum(tmp411, tmp34)
    tmp413 = tmp410 + tmp412
    tmp414 = tmp413 - tmp9
    tmp415 = tmp414 * tmp57
    tmp416 = tmp415 >= tmp34
    tmp417 = tl.where(tmp416, tmp402, tmp400)
    tmp418 = tmp401 * tmp12
    tmp419 = tmp417 + tmp418
    tmp420 = tmp0 - tmp419
    tmp421 = triton_helpers.maximum(tmp420, tmp34)
    tmp422 = tmp1 - tmp419
    tmp423 = triton_helpers.maximum(tmp422, tmp34)
    tmp424 = tmp421 + tmp423
    tmp425 = tmp3 - tmp419
    tmp426 = triton_helpers.maximum(tmp425, tmp34)
    tmp427 = tmp424 + tmp426
    tmp428 = tmp5 - tmp419
    tmp429 = triton_helpers.maximum(tmp428, tmp34)
    tmp430 = tmp427 + tmp429
    tmp431 = tmp430 - tmp9
    tmp432 = tmp431 * tmp57
    tmp433 = tmp432 >= tmp34
    tmp434 = tl.where(tmp433, tmp419, tmp417)
    tl.store(out_ptr0 + (x0), tmp30, xmask)
    tl.store(in_out_ptr16 + (x0), tmp434, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/yz/cyzkhbz7eylqmmsct2eisz274ptkf4xwckrryhdzr5c5xpld426a.py
# Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, tau_m_40, sub_86, p_m_40], Original ATen: [aten.div, aten.add, aten.sub, aten.clamp]
# Source node to ATen node mapping:
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   p_m_40 => clamp_min_41
#   sub_86 => sub_86
#   tau_m_40 => add_40
# Graph fragment:
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %add_40 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_39, %div_40), kwargs = {})
#   %sub_86 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_40), kwargs = {})
#   %clamp_min_41 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_86, 0), kwargs = {})
triton_poi_fused_add_clamp_div_sub_2 = async_compile.triton('triton_poi_fused_add_clamp_div_sub_2', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_sub_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_sub_2(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp1 + tmp26
    tmp28 = tmp0 - tmp27
    tmp29 = 0.0
    tmp30 = triton_helpers.maximum(tmp28, tmp29)
    tl.store(out_ptr0 + (x2), tmp30, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/sr/csrhhpesnpea33gn4n5cx2now3swxe3jsyebpywtfcwh4ny67d7d.py
# Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, tau_m_40, sum_42, f_m_40, mul_41, tau_lo_41], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
# Source node to ATen node mapping:
#   clamp => clamp_min
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   f_lo => sub_4
#   f_m_40 => sub_87
#   max_1 => max_1
#   mul_41 => mul_41
#   sub_3 => sub_3
#   sum_1 => sum_1
#   sum_42 => sum_42
#   tau_lo => sub_1
#   tau_lo_41 => where_40
#   tau_m_40 => add_40
# Graph fragment:
#   %max_1 : [num_users=1] = call_function[target=torch.ops.aten.max.dim](args = (%arg0_1, -1, True), kwargs = {})
#   %sub_1 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %sub_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min, [-1]), kwargs = {})
#   %sub_4 : [num_users=49] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_1, 1), kwargs = {})
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %add_40 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_39, %div_40), kwargs = {})
#   %sum_42 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_41, [-1]), kwargs = {})
#   %sub_87 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_42, 1), kwargs = {})
#   %mul_41 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_87, %sub_4), kwargs = {})
#   %where_40 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_40, %add_40, %where_39), kwargs = {})
triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3 = async_compile.triton('triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 10, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp32 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp33 = tl.load(in_ptr2 + (x0), xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 1.0
    tmp8 = tmp6 - tmp7
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp13 = triton_helpers.maximum(tmp11, tmp12)
    tmp15 = triton_helpers.maximum(tmp13, tmp14)
    tmp16 = tmp15 - tmp7
    tmp17 = tmp9 - tmp16
    tmp18 = 0.0
    tmp19 = triton_helpers.maximum(tmp17, tmp18)
    tmp20 = tmp10 - tmp16
    tmp21 = triton_helpers.maximum(tmp20, tmp18)
    tmp22 = tmp19 + tmp21
    tmp23 = tmp12 - tmp16
    tmp24 = triton_helpers.maximum(tmp23, tmp18)
    tmp25 = tmp22 + tmp24
    tmp26 = tmp14 - tmp16
    tmp27 = triton_helpers.maximum(tmp26, tmp18)
    tmp28 = tmp25 + tmp27
    tmp29 = tmp28 - tmp7
    tmp30 = tmp8 * tmp29
    tmp31 = tmp30 >= tmp18
    tmp34 = 0.5
    tmp35 = tmp33 * tmp34
    tmp36 = tmp35 * tmp34
    tmp37 = tmp36 * tmp34
    tmp38 = tmp37 * tmp34
    tmp39 = tmp38 * tmp34
    tmp40 = tmp39 * tmp34
    tmp41 = tmp40 * tmp34
    tmp42 = tmp41 * tmp34
    tmp43 = tmp42 * tmp34
    tmp44 = tmp43 * tmp34
    tmp45 = tmp44 * tmp34
    tmp46 = tmp45 * tmp34
    tmp47 = tmp46 * tmp34
    tmp48 = tmp47 * tmp34
    tmp49 = tmp48 * tmp34
    tmp50 = tmp49 * tmp34
    tmp51 = tmp50 * tmp34
    tmp52 = tmp51 * tmp34
    tmp53 = tmp52 * tmp34
    tmp54 = tmp53 * tmp34
    tmp55 = tmp54 * tmp34
    tmp56 = tmp55 * tmp34
    tmp57 = tmp56 * tmp34
    tmp58 = tmp32 + tmp57
    tmp59 = tl.where(tmp31, tmp58, tmp32)
    tl.store(in_out_ptr0 + (x0), tmp59, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/ri/cri5g5cwgob26dhdepr7at5q3uqt7g5zn5i44mttvzuefjefarlt.py
# Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, tau_m_41, sub_88, p_m_41], Original ATen: [aten.div, aten.add, aten.sub, aten.clamp]
# Source node to ATen node mapping:
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   dm_42 => div_41
#   p_m_41 => clamp_min_42
#   sub_88 => sub_88
#   tau_m_41 => add_41
# Graph fragment:
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %div_41 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_40, 2), kwargs = {})
#   %add_41 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_40, %div_41), kwargs = {})
#   %sub_88 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_41), kwargs = {})
#   %clamp_min_42 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_88, 0), kwargs = {})
triton_poi_fused_add_clamp_div_sub_4 = async_compile.triton('triton_poi_fused_add_clamp_div_sub_4', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_sub_4', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_sub_4(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp26 * tmp3
    tmp28 = tmp1 + tmp27
    tmp29 = tmp0 - tmp28
    tmp30 = 0.0
    tmp31 = triton_helpers.maximum(tmp29, tmp30)
    tl.store(out_ptr0 + (x2), tmp31, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/6v/c6v66pcoz5wwqqj3qdoavhcalhw4ggic7f5bbgnf4wulrawivqmo.py
# Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, tau_m_41, sum_43, f_m_41, mul_42, tau_lo_42], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
# Source node to ATen node mapping:
#   clamp => clamp_min
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   dm_42 => div_41
#   f_lo => sub_4
#   f_m_41 => sub_89
#   max_1 => max_1
#   mul_42 => mul_42
#   sub_3 => sub_3
#   sum_1 => sum_1
#   sum_43 => sum_43
#   tau_lo => sub_1
#   tau_lo_42 => where_41
#   tau_m_41 => add_41
# Graph fragment:
#   %max_1 : [num_users=1] = call_function[target=torch.ops.aten.max.dim](args = (%arg0_1, -1, True), kwargs = {})
#   %sub_1 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %sub_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min, [-1]), kwargs = {})
#   %sub_4 : [num_users=49] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_1, 1), kwargs = {})
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %div_41 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_40, 2), kwargs = {})
#   %add_41 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_40, %div_41), kwargs = {})
#   %sum_43 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_42, [-1]), kwargs = {})
#   %sub_89 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_43, 1), kwargs = {})
#   %mul_42 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_89, %sub_4), kwargs = {})
#   %where_41 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_41, %add_41, %where_40), kwargs = {})
triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5 = async_compile.triton('triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 10, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp32 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp33 = tl.load(in_ptr2 + (x0), xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 1.0
    tmp8 = tmp6 - tmp7
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp13 = triton_helpers.maximum(tmp11, tmp12)
    tmp15 = triton_helpers.maximum(tmp13, tmp14)
    tmp16 = tmp15 - tmp7
    tmp17 = tmp9 - tmp16
    tmp18 = 0.0
    tmp19 = triton_helpers.maximum(tmp17, tmp18)
    tmp20 = tmp10 - tmp16
    tmp21 = triton_helpers.maximum(tmp20, tmp18)
    tmp22 = tmp19 + tmp21
    tmp23 = tmp12 - tmp16
    tmp24 = triton_helpers.maximum(tmp23, tmp18)
    tmp25 = tmp22 + tmp24
    tmp26 = tmp14 - tmp16
    tmp27 = triton_helpers.maximum(tmp26, tmp18)
    tmp28 = tmp25 + tmp27
    tmp29 = tmp28 - tmp7
    tmp30 = tmp8 * tmp29
    tmp31 = tmp30 >= tmp18
    tmp34 = 0.5
    tmp35 = tmp33 * tmp34
    tmp36 = tmp35 * tmp34
    tmp37 = tmp36 * tmp34
    tmp38 = tmp37 * tmp34
    tmp39 = tmp38 * tmp34
    tmp40 = tmp39 * tmp34
    tmp41 = tmp40 * tmp34
    tmp42 = tmp41 * tmp34
    tmp43 = tmp42 * tmp34
    tmp44 = tmp43 * tmp34
    tmp45 = tmp44 * tmp34
    tmp46 = tmp45 * tmp34
    tmp47 = tmp46 * tmp34
    tmp48 = tmp47 * tmp34
    tmp49 = tmp48 * tmp34
    tmp50 = tmp49 * tmp34
    tmp51 = tmp50 * tmp34
    tmp52 = tmp51 * tmp34
    tmp53 = tmp52 * tmp34
    tmp54 = tmp53 * tmp34
    tmp55 = tmp54 * tmp34
    tmp56 = tmp55 * tmp34
    tmp57 = tmp56 * tmp34
    tmp58 = tmp57 * tmp34
    tmp59 = tmp32 + tmp58
    tmp60 = tl.where(tmp31, tmp59, tmp32)
    tl.store(in_out_ptr0 + (x0), tmp60, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/lg/clgmpssl52or2lky2wemwq23igzgtq7po6uel2vq4hq3f6g72lml.py
# Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, tau_m_42, sub_90], Original ATen: [aten.div, aten.add, aten.sub]
# Source node to ATen node mapping:
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   dm_42 => div_41
#   dm_43 => div_42
#   sub_90 => sub_90
#   tau_m_42 => add_42
# Graph fragment:
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %div_41 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_40, 2), kwargs = {})
#   %div_42 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_41, 2), kwargs = {})
#   %add_42 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_41, %div_42), kwargs = {})
#   %sub_90 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_42), kwargs = {})
triton_poi_fused_add_div_sub_6 = async_compile.triton('triton_poi_fused_add_div_sub_6', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_sub_6', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_div_sub_6(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp26 * tmp3
    tmp28 = tmp27 * tmp3
    tmp29 = tmp1 + tmp28
    tmp30 = tmp0 - tmp29
    tl.store(out_ptr0 + (x2), tmp30, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/jl/cjlkx2otyy2fduimnbn7ccxqmgq2wq4zlcyndzdk767y2f6xq7z2.py
# Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, tau_m_42, p_m_42, sum_44, f_m_42, mul_43, tau_lo_43], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
# Source node to ATen node mapping:
#   clamp => clamp_min
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   dm_42 => div_41
#   dm_43 => div_42
#   f_lo => sub_4
#   f_m_42 => sub_91
#   max_1 => max_1
#   mul_43 => mul_43
#   p_m_42 => clamp_min_43
#   sub_3 => sub_3
#   sum_1 => sum_1
#   sum_44 => sum_44
#   tau_lo => sub_1
#   tau_lo_43 => where_42
#   tau_m_42 => add_42
# Graph fragment:
#   %max_1 : [num_users=1] = call_function[target=torch.ops.aten.max.dim](args = (%arg0_1, -1, True), kwargs = {})
#   %sub_1 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %sub_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min, [-1]), kwargs = {})
#   %sub_4 : [num_users=49] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_1, 1), kwargs = {})
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %div_41 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_40, 2), kwargs = {})
#   %div_42 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_41, 2), kwargs = {})
#   %add_42 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_41, %div_42), kwargs = {})
#   %clamp_min_43 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_90, 0), kwargs = {})
#   %sum_44 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_43, [-1]), kwargs = {})
#   %sub_91 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_44, 1), kwargs = {})
#   %mul_43 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_91, %sub_4), kwargs = {})
#   %where_42 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_42, %add_42, %where_41), kwargs = {})
triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7 = async_compile.triton('triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 10, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp37 = tl.load(in_ptr2 + (x0), xmask)
    tmp1 = 0.0
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp3, tmp1)
    tmp5 = tmp2 + tmp4
    tmp7 = triton_helpers.maximum(tmp6, tmp1)
    tmp8 = tmp5 + tmp7
    tmp10 = triton_helpers.maximum(tmp9, tmp1)
    tmp11 = tmp8 + tmp10
    tmp12 = 1.0
    tmp13 = tmp11 - tmp12
    tmp16 = triton_helpers.maximum(tmp14, tmp15)
    tmp18 = triton_helpers.maximum(tmp16, tmp17)
    tmp20 = triton_helpers.maximum(tmp18, tmp19)
    tmp21 = tmp20 - tmp12
    tmp22 = tmp14 - tmp21
    tmp23 = triton_helpers.maximum(tmp22, tmp1)
    tmp24 = tmp15 - tmp21
    tmp25 = triton_helpers.maximum(tmp24, tmp1)
    tmp26 = tmp23 + tmp25
    tmp27 = tmp17 - tmp21
    tmp28 = triton_helpers.maximum(tmp27, tmp1)
    tmp29 = tmp26 + tmp28
    tmp30 = tmp19 - tmp21
    tmp31 = triton_helpers.maximum(tmp30, tmp1)
    tmp32 = tmp29 + tmp31
    tmp33 = tmp32 - tmp12
    tmp34 = tmp13 * tmp33
    tmp35 = tmp34 >= tmp1
    tmp38 = 0.5
    tmp39 = tmp37 * tmp38
    tmp40 = tmp39 * tmp38
    tmp41 = tmp40 * tmp38
    tmp42 = tmp41 * tmp38
    tmp43 = tmp42 * tmp38
    tmp44 = tmp43 * tmp38
    tmp45 = tmp44 * tmp38
    tmp46 = tmp45 * tmp38
    tmp47 = tmp46 * tmp38
    tmp48 = tmp47 * tmp38
    tmp49 = tmp48 * tmp38
    tmp50 = tmp49 * tmp38
    tmp51 = tmp50 * tmp38
    tmp52 = tmp51 * tmp38
    tmp53 = tmp52 * tmp38
    tmp54 = tmp53 * tmp38
    tmp55 = tmp54 * tmp38
    tmp56 = tmp55 * tmp38
    tmp57 = tmp56 * tmp38
    tmp58 = tmp57 * tmp38
    tmp59 = tmp58 * tmp38
    tmp60 = tmp59 * tmp38
    tmp61 = tmp60 * tmp38
    tmp62 = tmp61 * tmp38
    tmp63 = tmp62 * tmp38
    tmp64 = tmp36 + tmp63
    tmp65 = tl.where(tmp35, tmp64, tmp36)
    tl.store(in_out_ptr0 + (x0), tmp65, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/45/c45ntljmhht4tqet2q6qjdfrins55gu6vaasohzaiqpfex6sk7ob.py
# Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, dm_44, tau_m_43, sub_92], Original ATen: [aten.div, aten.add, aten.sub]
# Source node to ATen node mapping:
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   dm_42 => div_41
#   dm_43 => div_42
#   dm_44 => div_43
#   sub_92 => sub_92
#   tau_m_43 => add_43
# Graph fragment:
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %div_41 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_40, 2), kwargs = {})
#   %div_42 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_41, 2), kwargs = {})
#   %div_43 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_42, 2), kwargs = {})
#   %add_43 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_42, %div_43), kwargs = {})
#   %sub_92 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_43), kwargs = {})
triton_poi_fused_add_div_sub_8 = async_compile.triton('triton_poi_fused_add_div_sub_8', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_div_sub_8', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_div_sub_8(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp26 * tmp3
    tmp28 = tmp27 * tmp3
    tmp29 = tmp28 * tmp3
    tmp30 = tmp1 + tmp29
    tmp31 = tmp0 - tmp30
    tl.store(out_ptr0 + (x2), tmp31, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/lz/clzcekwx3vzl5uustsl63asl5aemxd4bfzovv6jgg7f5yz6ljzjf.py
# Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, dm_44, tau_m_43, p_m_43, sum_45, f_m_43, mul_44, tau_lo_44, dm_45, tau_m_44, sub_94, p_m_44, sum_46, f_m_44, mul_45, tau_lo_45, dm_46, tau_m_45, sub_96, p_m_45, sum_47, f_m_45, mul_46, tau_lo_46, dm_47, tau_m_46, sub_98, p_m_46, sum_48, f_m_46, mul_47, tau_lo_47, dm_48, tau_m_47, sub_100, p_m_47, sum_49, f_m_47, mul_48, tau_lo_48, dm_49, tau_m_48, sub_102, p_m_48, sum_50, f_m_48, tau_lo_49, dm_50, tau_m_49, sub_104, p_m_49, sum_52], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
# Source node to ATen node mapping:
#   clamp => clamp_min
#   dm_19 => div_18
#   dm_20 => div_19
#   dm_21 => div_20
#   dm_22 => div_21
#   dm_23 => div_22
#   dm_24 => div_23
#   dm_25 => div_24
#   dm_26 => div_25
#   dm_27 => div_26
#   dm_28 => div_27
#   dm_29 => div_28
#   dm_30 => div_29
#   dm_31 => div_30
#   dm_32 => div_31
#   dm_33 => div_32
#   dm_34 => div_33
#   dm_35 => div_34
#   dm_36 => div_35
#   dm_37 => div_36
#   dm_38 => div_37
#   dm_39 => div_38
#   dm_40 => div_39
#   dm_41 => div_40
#   dm_42 => div_41
#   dm_43 => div_42
#   dm_44 => div_43
#   dm_45 => div_44
#   dm_46 => div_45
#   dm_47 => div_46
#   dm_48 => div_47
#   dm_49 => div_48
#   dm_50 => div_49
#   f_lo => sub_4
#   f_m_43 => sub_93
#   f_m_44 => sub_95
#   f_m_45 => sub_97
#   f_m_46 => sub_99
#   f_m_47 => sub_101
#   f_m_48 => sub_103
#   max_1 => max_1
#   mul_44 => mul_44
#   mul_45 => mul_45
#   mul_46 => mul_46
#   mul_47 => mul_47
#   mul_48 => mul_48
#   p_m_43 => clamp_min_44
#   p_m_44 => clamp_min_45
#   p_m_45 => clamp_min_46
#   p_m_46 => clamp_min_47
#   p_m_47 => clamp_min_48
#   p_m_48 => clamp_min_49
#   p_m_49 => clamp_min_50
#   sub_100 => sub_100
#   sub_102 => sub_102
#   sub_104 => sub_104
#   sub_3 => sub_3
#   sub_94 => sub_94
#   sub_96 => sub_96
#   sub_98 => sub_98
#   sum_1 => sum_1
#   sum_45 => sum_45
#   sum_46 => sum_46
#   sum_47 => sum_47
#   sum_48 => sum_48
#   sum_49 => sum_49
#   sum_50 => sum_50
#   sum_52 => sum_52
#   tau_lo => sub_1
#   tau_lo_44 => where_43
#   tau_lo_45 => where_44
#   tau_lo_46 => where_45
#   tau_lo_47 => where_46
#   tau_lo_48 => where_47
#   tau_lo_49 => where_48
#   tau_m_43 => add_43
#   tau_m_44 => add_44
#   tau_m_45 => add_45
#   tau_m_46 => add_46
#   tau_m_47 => add_47
#   tau_m_48 => add_48
#   tau_m_49 => add_49
# Graph fragment:
#   %max_1 : [num_users=1] = call_function[target=torch.ops.aten.max.dim](args = (%arg0_1, -1, True), kwargs = {})
#   %sub_1 : [num_users=4] = call_function[target=torch.ops.aten.sub.Tensor](args = (%getitem, 1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %sub_1), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_3, 0), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min, [-1]), kwargs = {})
#   %sub_4 : [num_users=49] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_1, 1), kwargs = {})
#   %div_18 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_17, 2), kwargs = {})
#   %div_19 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_18, 2), kwargs = {})
#   %div_20 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_19, 2), kwargs = {})
#   %div_21 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_20, 2), kwargs = {})
#   %div_22 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_21, 2), kwargs = {})
#   %div_23 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_22, 2), kwargs = {})
#   %div_24 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_23, 2), kwargs = {})
#   %div_25 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_24, 2), kwargs = {})
#   %div_26 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_25, 2), kwargs = {})
#   %div_27 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_26, 2), kwargs = {})
#   %div_28 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_27, 2), kwargs = {})
#   %div_29 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_28, 2), kwargs = {})
#   %div_30 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_29, 2), kwargs = {})
#   %div_31 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_30, 2), kwargs = {})
#   %div_32 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_31, 2), kwargs = {})
#   %div_33 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_32, 2), kwargs = {})
#   %div_34 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_33, 2), kwargs = {})
#   %div_35 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_34, 2), kwargs = {})
#   %div_36 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_35, 2), kwargs = {})
#   %div_37 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_36, 2), kwargs = {})
#   %div_38 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_37, 2), kwargs = {})
#   %div_39 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_38, 2), kwargs = {})
#   %div_40 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_39, 2), kwargs = {})
#   %div_41 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_40, 2), kwargs = {})
#   %div_42 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_41, 2), kwargs = {})
#   %div_43 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_42, 2), kwargs = {})
#   %add_43 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_42, %div_43), kwargs = {})
#   %clamp_min_44 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_92, 0), kwargs = {})
#   %sum_45 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_44, [-1]), kwargs = {})
#   %sub_93 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_45, 1), kwargs = {})
#   %mul_44 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_93, %sub_4), kwargs = {})
#   %where_43 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_43, %add_43, %where_42), kwargs = {})
#   %div_44 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_43, 2), kwargs = {})
#   %add_44 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_43, %div_44), kwargs = {})
#   %sub_94 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_44), kwargs = {})
#   %clamp_min_45 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_94, 0), kwargs = {})
#   %sum_46 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_45, [-1]), kwargs = {})
#   %sub_95 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_46, 1), kwargs = {})
#   %mul_45 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_95, %sub_4), kwargs = {})
#   %where_44 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_44, %add_44, %where_43), kwargs = {})
#   %div_45 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_44, 2), kwargs = {})
#   %add_45 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_44, %div_45), kwargs = {})
#   %sub_96 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_45), kwargs = {})
#   %clamp_min_46 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_96, 0), kwargs = {})
#   %sum_47 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_46, [-1]), kwargs = {})
#   %sub_97 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_47, 1), kwargs = {})
#   %mul_46 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_97, %sub_4), kwargs = {})
#   %where_45 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_45, %add_45, %where_44), kwargs = {})
#   %div_46 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_45, 2), kwargs = {})
#   %add_46 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_45, %div_46), kwargs = {})
#   %sub_98 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_46), kwargs = {})
#   %clamp_min_47 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_98, 0), kwargs = {})
#   %sum_48 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_47, [-1]), kwargs = {})
#   %sub_99 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_48, 1), kwargs = {})
#   %mul_47 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_99, %sub_4), kwargs = {})
#   %where_46 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_46, %add_46, %where_45), kwargs = {})
#   %div_47 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_46, 2), kwargs = {})
#   %add_47 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_46, %div_47), kwargs = {})
#   %sub_100 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_47), kwargs = {})
#   %clamp_min_48 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_100, 0), kwargs = {})
#   %sum_49 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_48, [-1]), kwargs = {})
#   %sub_101 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_49, 1), kwargs = {})
#   %mul_48 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_101, %sub_4), kwargs = {})
#   %where_47 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_47, %add_47, %where_46), kwargs = {})
#   %div_48 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_47, 2), kwargs = {})
#   %add_48 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_47, %div_48), kwargs = {})
#   %sub_102 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_48), kwargs = {})
#   %clamp_min_49 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_102, 0), kwargs = {})
#   %sum_50 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_49, [-1]), kwargs = {})
#   %sub_103 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sum_50, 1), kwargs = {})
#   %where_48 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%unsqueeze_48, %add_48, %where_47), kwargs = {})
#   %div_49 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_48, 2), kwargs = {})
#   %add_49 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_48, %div_49), kwargs = {})
#   %sub_104 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_49), kwargs = {})
#   %clamp_min_50 : [num_users=2] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_104, 0), kwargs = {})
#   %sum_52 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%clamp_min_50, [-1]), kwargs = {})
triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9 = async_compile.triton('triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: '*fp32', 7: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 6, 7), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9', 'mutated_arg_names': ['in_out_ptr0', 'in_out_ptr2'], 'no_x_dim': False, 'num_load': 10, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9(in_out_ptr0, in_out_ptr2, in_ptr0, in_ptr1, in_ptr2, out_ptr4, out_ptr7, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (4*x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + (4*x0), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr1 + (1 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr1 + (2 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr1 + (3 + (4*x0)), xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_out_ptr0 + (x0), xmask)
    tmp37 = tl.load(in_ptr2 + (x0), xmask)
    tmp1 = 0.0
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp3, tmp1)
    tmp5 = tmp2 + tmp4
    tmp7 = triton_helpers.maximum(tmp6, tmp1)
    tmp8 = tmp5 + tmp7
    tmp10 = triton_helpers.maximum(tmp9, tmp1)
    tmp11 = tmp8 + tmp10
    tmp12 = 1.0
    tmp13 = tmp11 - tmp12
    tmp16 = triton_helpers.maximum(tmp14, tmp15)
    tmp18 = triton_helpers.maximum(tmp16, tmp17)
    tmp20 = triton_helpers.maximum(tmp18, tmp19)
    tmp21 = tmp20 - tmp12
    tmp22 = tmp14 - tmp21
    tmp23 = triton_helpers.maximum(tmp22, tmp1)
    tmp24 = tmp15 - tmp21
    tmp25 = triton_helpers.maximum(tmp24, tmp1)
    tmp26 = tmp23 + tmp25
    tmp27 = tmp17 - tmp21
    tmp28 = triton_helpers.maximum(tmp27, tmp1)
    tmp29 = tmp26 + tmp28
    tmp30 = tmp19 - tmp21
    tmp31 = triton_helpers.maximum(tmp30, tmp1)
    tmp32 = tmp29 + tmp31
    tmp33 = tmp32 - tmp12
    tmp34 = tmp13 * tmp33
    tmp35 = tmp34 >= tmp1
    tmp38 = 0.5
    tmp39 = tmp37 * tmp38
    tmp40 = tmp39 * tmp38
    tmp41 = tmp40 * tmp38
    tmp42 = tmp41 * tmp38
    tmp43 = tmp42 * tmp38
    tmp44 = tmp43 * tmp38
    tmp45 = tmp44 * tmp38
    tmp46 = tmp45 * tmp38
    tmp47 = tmp46 * tmp38
    tmp48 = tmp47 * tmp38
    tmp49 = tmp48 * tmp38
    tmp50 = tmp49 * tmp38
    tmp51 = tmp50 * tmp38
    tmp52 = tmp51 * tmp38
    tmp53 = tmp52 * tmp38
    tmp54 = tmp53 * tmp38
    tmp55 = tmp54 * tmp38
    tmp56 = tmp55 * tmp38
    tmp57 = tmp56 * tmp38
    tmp58 = tmp57 * tmp38
    tmp59 = tmp58 * tmp38
    tmp60 = tmp59 * tmp38
    tmp61 = tmp60 * tmp38
    tmp62 = tmp61 * tmp38
    tmp63 = tmp62 * tmp38
    tmp64 = tmp63 * tmp38
    tmp65 = tmp36 + tmp64
    tmp66 = tl.where(tmp35, tmp65, tmp36)
    tmp67 = tmp64 * tmp38
    tmp68 = tmp66 + tmp67
    tmp69 = tmp14 - tmp68
    tmp70 = triton_helpers.maximum(tmp69, tmp1)
    tmp71 = tmp15 - tmp68
    tmp72 = triton_helpers.maximum(tmp71, tmp1)
    tmp73 = tmp70 + tmp72
    tmp74 = tmp17 - tmp68
    tmp75 = triton_helpers.maximum(tmp74, tmp1)
    tmp76 = tmp73 + tmp75
    tmp77 = tmp19 - tmp68
    tmp78 = triton_helpers.maximum(tmp77, tmp1)
    tmp79 = tmp76 + tmp78
    tmp80 = tmp79 - tmp12
    tmp81 = tmp80 * tmp33
    tmp82 = tmp81 >= tmp1
    tmp83 = tl.where(tmp82, tmp68, tmp66)
    tmp84 = tmp67 * tmp38
    tmp85 = tmp83 + tmp84
    tmp86 = tmp14 - tmp85
    tmp87 = triton_helpers.maximum(tmp86, tmp1)
    tmp88 = tmp15 - tmp85
    tmp89 = triton_helpers.maximum(tmp88, tmp1)
    tmp90 = tmp87 + tmp89
    tmp91 = tmp17 - tmp85
    tmp92 = triton_helpers.maximum(tmp91, tmp1)
    tmp93 = tmp90 + tmp92
    tmp94 = tmp19 - tmp85
    tmp95 = triton_helpers.maximum(tmp94, tmp1)
    tmp96 = tmp93 + tmp95
    tmp97 = tmp96 - tmp12
    tmp98 = tmp97 * tmp33
    tmp99 = tmp98 >= tmp1
    tmp100 = tl.where(tmp99, tmp85, tmp83)
    tmp101 = tmp84 * tmp38
    tmp102 = tmp100 + tmp101
    tmp103 = tmp14 - tmp102
    tmp104 = triton_helpers.maximum(tmp103, tmp1)
    tmp105 = tmp15 - tmp102
    tmp106 = triton_helpers.maximum(tmp105, tmp1)
    tmp107 = tmp104 + tmp106
    tmp108 = tmp17 - tmp102
    tmp109 = triton_helpers.maximum(tmp108, tmp1)
    tmp110 = tmp107 + tmp109
    tmp111 = tmp19 - tmp102
    tmp112 = triton_helpers.maximum(tmp111, tmp1)
    tmp113 = tmp110 + tmp112
    tmp114 = tmp113 - tmp12
    tmp115 = tmp114 * tmp33
    tmp116 = tmp115 >= tmp1
    tmp117 = tl.where(tmp116, tmp102, tmp100)
    tmp118 = tmp101 * tmp38
    tmp119 = tmp117 + tmp118
    tmp120 = tmp14 - tmp119
    tmp121 = triton_helpers.maximum(tmp120, tmp1)
    tmp122 = tmp15 - tmp119
    tmp123 = triton_helpers.maximum(tmp122, tmp1)
    tmp124 = tmp121 + tmp123
    tmp125 = tmp17 - tmp119
    tmp126 = triton_helpers.maximum(tmp125, tmp1)
    tmp127 = tmp124 + tmp126
    tmp128 = tmp19 - tmp119
    tmp129 = triton_helpers.maximum(tmp128, tmp1)
    tmp130 = tmp127 + tmp129
    tmp131 = tmp130 - tmp12
    tmp132 = tmp131 * tmp33
    tmp133 = tmp132 >= tmp1
    tmp134 = tl.where(tmp133, tmp119, tmp117)
    tmp135 = tmp118 * tmp38
    tmp136 = tmp134 + tmp135
    tmp137 = tmp14 - tmp136
    tmp138 = triton_helpers.maximum(tmp137, tmp1)
    tmp139 = tmp15 - tmp136
    tmp140 = triton_helpers.maximum(tmp139, tmp1)
    tmp141 = tmp138 + tmp140
    tmp142 = tmp17 - tmp136
    tmp143 = triton_helpers.maximum(tmp142, tmp1)
    tmp144 = tmp141 + tmp143
    tmp145 = tmp19 - tmp136
    tmp146 = triton_helpers.maximum(tmp145, tmp1)
    tmp147 = tmp144 + tmp146
    tmp148 = tmp147 - tmp12
    tmp149 = tmp148 * tmp33
    tmp150 = tmp149 >= tmp1
    tmp151 = tl.where(tmp150, tmp136, tmp134)
    tmp152 = tmp135 * tmp38
    tmp153 = tmp151 + tmp152
    tmp154 = tmp14 - tmp153
    tmp155 = triton_helpers.maximum(tmp154, tmp1)
    tmp156 = tmp15 - tmp153
    tmp157 = triton_helpers.maximum(tmp156, tmp1)
    tmp158 = tmp155 + tmp157
    tmp159 = tmp17 - tmp153
    tmp160 = triton_helpers.maximum(tmp159, tmp1)
    tmp161 = tmp158 + tmp160
    tmp162 = tmp19 - tmp153
    tmp163 = triton_helpers.maximum(tmp162, tmp1)
    tmp164 = tmp161 + tmp163
    tl.store(out_ptr4 + (x0), tmp101, xmask)
    tl.store(in_out_ptr2 + (x0), tmp151, xmask)
    tl.store(out_ptr7 + (x0), tmp164, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/qe/cqe4wxdrqmlpdjpsore2xrtnu7imed3hrgbsaycsyw5yzkt5vtf2.py
# Topologically Sorted Source Nodes: [dm_48, dm_49, dm_50, tau_m_49, sub_104, p_m_49, p_m_50], Original ATen: [aten.div, aten.add, aten.sub, aten.clamp]
# Source node to ATen node mapping:
#   dm_48 => div_47
#   dm_49 => div_48
#   dm_50 => div_49
#   p_m_49 => clamp_min_50
#   p_m_50 => div_50
#   sub_104 => sub_104
#   tau_m_49 => add_49
# Graph fragment:
#   %div_47 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_46, 2), kwargs = {})
#   %div_48 : [num_users=2] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_47, 2), kwargs = {})
#   %div_49 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%div_48, 2), kwargs = {})
#   %add_49 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%where_48, %div_49), kwargs = {})
#   %sub_104 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %add_49), kwargs = {})
#   %clamp_min_50 : [num_users=2] = call_function[target=torch.ops.aten.clamp_min.default](args = (%sub_104, 0), kwargs = {})
#   %div_50 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%clamp_min_50, %unsqueeze_50), kwargs = {})
triton_poi_fused_add_clamp_div_sub_10 = async_compile.triton('triton_poi_fused_add_clamp_div_sub_10', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_div_sub_10', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 4, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_clamp_div_sub_10(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + (x1), xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + (x1), xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp1 + tmp6
    tmp8 = tmp0 - tmp7
    tmp9 = 0.0
    tmp10 = triton_helpers.maximum(tmp8, tmp9)
    tmp12 = tmp10 / tmp11
    tl.store(out_ptr0 + (x2), tmp12, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf40 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf41 = reinterpret_tensor(buf40, (4, 4, 4, 1), (16, 4, 1, 64), 0); del buf40  # reuse
        # Topologically Sorted Source Nodes: [max_1, tau_hi, tau_lo, dm, dm_1, tau_m, sub_6, p_m, sum_2, f_m, sub_3, clamp, sum_1, f_lo, mul_1, tau_lo_1, dm_2, tau_m_1, sub_8, p_m_1, sum_3, f_m_1, mul_2, tau_lo_2, dm_3, tau_m_2, sub_10, p_m_2, sum_4, f_m_2, mul_3, tau_lo_3, dm_4, tau_m_3, sub_12, p_m_3, sum_5, f_m_3, mul_4, tau_lo_4, dm_5, tau_m_4, sub_14, p_m_4, sum_6, f_m_4, mul_5, tau_lo_5, dm_6, tau_m_5, sub_16, p_m_5, sum_7, f_m_5, mul_6, tau_lo_6, dm_7, tau_m_6, sub_18, p_m_6, sum_8, f_m_6, mul_7, tau_lo_7, dm_8, tau_m_7, sub_20, p_m_7, sum_9, f_m_7, mul_8, tau_lo_8, dm_9, tau_m_8, sub_22, p_m_8, sum_10, f_m_8, mul_9, tau_lo_9, dm_10, tau_m_9, sub_24, p_m_9, sum_11, f_m_9, mul_10, tau_lo_10, dm_11, tau_m_10, sub_26, p_m_10, sum_12, f_m_10, mul_11, tau_lo_11, dm_12, tau_m_11, sub_28, p_m_11, sum_13, f_m_11, mul_12, tau_lo_12, dm_13, tau_m_12, sub_30, p_m_12, sum_14, f_m_12, mul_13, tau_lo_13, dm_14, tau_m_13, sub_32, p_m_13, sum_15, f_m_13, mul_14, tau_lo_14, dm_15, tau_m_14, sub_34, p_m_14, sum_16, f_m_14, mul_15, tau_lo_15, dm_16, tau_m_15, sub_36, p_m_15, sum_17, f_m_15, mul_16, tau_lo_16, dm_17, tau_m_16, sub_38, p_m_16, sum_18, f_m_16, mul_17, tau_lo_17], Original ATen: [aten.max, aten.sub, aten.div, aten.add, aten.clamp, aten.sum, aten.mul, aten.where]
        stream0 = get_raw_stream(0)
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0.run(buf41, arg0_1, 64, grid=grid(64), stream=stream0)
        buf42 = empty_strided_cuda((4, 4, 4, 1), (16, 4, 1, 64), torch.float32)
        buf81 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf82 = reinterpret_tensor(buf81, (4, 4, 4, 1), (16, 4, 1, 64), 0); del buf81  # reuse
        # Topologically Sorted Source Nodes: [max_1, tau_hi, tau_lo, dm, dm_1, sub_3, clamp, sum_1, f_lo, dm_2, dm_3, dm_4, dm_5, dm_6, dm_7, dm_8, dm_9, dm_10, dm_11, dm_12, dm_13, dm_14, dm_15, dm_16, dm_17, dm_18, tau_m_17, sub_40, p_m_17, sum_19, f_m_17, mul_18, tau_lo_18, dm_19, tau_m_18, sub_42, p_m_18, sum_20, f_m_18, mul_19, tau_lo_19, dm_20, tau_m_19, sub_44, p_m_19, sum_21, f_m_19, tau_lo_20, dm_21, tau_m_20, sub_46, p_m_20, sum_22, f_m_20, mul_21, tau_lo_21, dm_22, tau_m_21, sub_48, p_m_21, sum_23, f_m_21, mul_22, tau_lo_22, dm_23, tau_m_22, sub_50, p_m_22, sum_24, tau_lo_23, dm_24, tau_m_23, sub_52, p_m_23, sum_25, f_m_23, mul_24, tau_lo_24, dm_25, tau_m_24, sub_54, p_m_24, sum_26, tau_lo_25, dm_26, tau_m_25, sub_56, p_m_25, sum_27, f_m_25, mul_26, tau_lo_26, dm_27, tau_m_26, sub_58, p_m_26, sum_28, tau_lo_27, dm_28, tau_m_27, sub_60, p_m_27, sum_29, f_m_27, tau_lo_28, dm_29, tau_m_28, sub_62, p_m_28, sum_30, tau_lo_29, dm_30, tau_m_29, sub_64, p_m_29, sum_31, tau_lo_30, dm_31, tau_m_30, sub_66, p_m_30, sum_32, tau_lo_31, dm_32, tau_m_31, sub_68, p_m_31, sum_33, tau_lo_32, dm_33, tau_m_32, sub_70, p_m_32, sum_34, tau_lo_33, dm_34, tau_m_33, sub_72, p_m_33, sum_35, tau_lo_34, dm_35, tau_m_34, sub_74, p_m_34, sum_36, tau_lo_35, dm_36, tau_m_35, sub_76, p_m_35, sum_37, tau_lo_36, dm_37, tau_m_36, sub_78, p_m_36, sum_38, tau_lo_37, dm_38, tau_m_37, sub_80, p_m_37, sum_39, tau_lo_38, dm_39, tau_m_38, sub_82, p_m_38, sum_40, tau_lo_39, dm_40, tau_m_39, sub_84, p_m_39, sum_41, tau_lo_40], Original ATen: [aten.max, aten.sub, aten.div, aten.clamp, aten.sum, aten.add, aten.mul, aten.where]
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1.run(buf82, arg0_1, buf41, buf42, 64, grid=grid(64), stream=stream0)
        buf83 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, tau_m_40, sub_86, p_m_40], Original ATen: [aten.div, aten.add, aten.sub, aten.clamp]
        triton_poi_fused_add_clamp_div_sub_2.run(arg0_1, buf82, buf42, buf83, 256, grid=grid(256), stream=stream0)
        buf85 = buf82; del buf82  # reuse
        # Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, tau_m_40, sum_42, f_m_40, mul_41, tau_lo_41], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3.run(buf85, buf83, arg0_1, buf42, 64, grid=grid(64), stream=stream0)
        buf86 = buf83; del buf83  # reuse
        # Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, tau_m_41, sub_88, p_m_41], Original ATen: [aten.div, aten.add, aten.sub, aten.clamp]
        triton_poi_fused_add_clamp_div_sub_4.run(arg0_1, buf85, buf42, buf86, 256, grid=grid(256), stream=stream0)
        buf88 = buf85; del buf85  # reuse
        # Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, tau_m_41, sum_43, f_m_41, mul_42, tau_lo_42], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5.run(buf88, buf86, arg0_1, buf42, 64, grid=grid(64), stream=stream0)
        buf89 = buf86; del buf86  # reuse
        # Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, tau_m_42, sub_90], Original ATen: [aten.div, aten.add, aten.sub]
        triton_poi_fused_add_div_sub_6.run(arg0_1, buf88, buf42, buf89, 256, grid=grid(256), stream=stream0)
        buf91 = buf88; del buf88  # reuse
        # Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, tau_m_42, p_m_42, sum_44, f_m_42, mul_43, tau_lo_43], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7.run(buf91, buf89, arg0_1, buf42, 64, grid=grid(64), stream=stream0)
        buf92 = buf89; del buf89  # reuse
        # Topologically Sorted Source Nodes: [dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, dm_44, tau_m_43, sub_92], Original ATen: [aten.div, aten.add, aten.sub]
        triton_poi_fused_add_div_sub_8.run(arg0_1, buf91, buf42, buf92, 256, grid=grid(256), stream=stream0)
        buf94 = buf91; del buf91  # reuse
        buf100 = buf41; del buf41  # reuse
        buf103 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf104 = reinterpret_tensor(buf103, (4, 4, 4, 1), (16, 4, 1, 64), 0); del buf103  # reuse
        buf105 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [max_1, tau_lo, sub_3, clamp, sum_1, f_lo, dm_19, dm_20, dm_21, dm_22, dm_23, dm_24, dm_25, dm_26, dm_27, dm_28, dm_29, dm_30, dm_31, dm_32, dm_33, dm_34, dm_35, dm_36, dm_37, dm_38, dm_39, dm_40, dm_41, dm_42, dm_43, dm_44, tau_m_43, p_m_43, sum_45, f_m_43, mul_44, tau_lo_44, dm_45, tau_m_44, sub_94, p_m_44, sum_46, f_m_44, mul_45, tau_lo_45, dm_46, tau_m_45, sub_96, p_m_45, sum_47, f_m_45, mul_46, tau_lo_46, dm_47, tau_m_46, sub_98, p_m_46, sum_48, f_m_46, mul_47, tau_lo_47, dm_48, tau_m_47, sub_100, p_m_47, sum_49, f_m_47, mul_48, tau_lo_48, dm_49, tau_m_48, sub_102, p_m_48, sum_50, f_m_48, tau_lo_49, dm_50, tau_m_49, sub_104, p_m_49, sum_52], Original ATen: [aten.max, aten.sub, aten.clamp, aten.sum, aten.div, aten.add, aten.mul, aten.where]
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9.run(buf94, buf104, buf92, arg0_1, buf42, buf100, buf105, 64, grid=grid(64), stream=stream0)
        del buf42
        del buf94
        buf106 = buf92; del buf92  # reuse
        # Topologically Sorted Source Nodes: [dm_48, dm_49, dm_50, tau_m_49, sub_104, p_m_49, p_m_50], Original ATen: [aten.div, aten.add, aten.sub, aten.clamp]
        triton_poi_fused_add_clamp_div_sub_10.run(arg0_1, buf104, buf100, buf105, buf106, 256, grid=grid(256), stream=stream0)
        del arg0_1
        del buf100
        del buf104
        del buf105
    return (buf106, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([arg0_1])
    return print_performance(fn, times=times, repeat=repeat)


if __name__ == "__main__":
    from torch._inductor.wrapper_benchmark import compiled_module_main
    compiled_module_main('None', benchmark_compiled_module)

from torch.autograd import Function
import torch
import torch.nn as nn


def sparsemax_bisect(X, dim=-1, n_iter=50, ensure_sum_one=True):
    """sparsemax: normalizing sparse transform (a la softmax), via bisection.

    Solves the projection:

        min_p ||x - p||_2   s.t.    p >= 0, sum(p) == 1.

    Parameters
    ----------
    X : torch.Tensor
        The input tensor.

    dim : int
        The dimension along which to apply sparsemax.

    n_iter : int
        Number of bisection iterations. For float32, 24 iterations should
        suffice for machine precision.

    ensure_sum_one : bool,
        Whether to divide the result by its sum. If false, the result might
        sum to close but not exactly 1, which might cause downstream problems.

    Note: This function does not yet support normalizing along anything except
    the last dimension. Please use transposing and views to achieve more
    general behavior.

    Returns
    -------
    P : torch tensor, same shape as X
        The projection result, such that P.sum(dim=dim) == 1 elementwise.
    """
    return SparsemaxBisectFunction.apply(X, dim, n_iter, ensure_sum_one)


class EntmaxBisectFunction(Function):

    @classmethod
    def _gp(cls, x, alpha):
        return x ** (alpha - 1)

    @classmethod
    def _gp_inv(cls, y, alpha):
        return y ** (1 / (alpha - 1))

    @classmethod
    def _p(cls, X, alpha):
        return cls._gp_inv(torch.clamp(X, min=0), alpha)

    @classmethod
    def forward(cls, ctx, X, alpha=1.5, dim=-1, n_iter=50, ensure_sum_one=True
        ):
        if not isinstance(alpha, torch.Tensor):
            alpha = torch.tensor(alpha, dtype=X.dtype, device=X.device)
        alpha_shape = list(X.shape)
        alpha_shape[dim] = 1
        alpha = alpha.expand(*alpha_shape)
        ctx.alpha = alpha
        ctx.dim = dim
        d = X.shape[dim]
        X = X * (alpha - 1)
        max_val, _ = X.max(dim=dim, keepdim=True)
        tau_lo = max_val - cls._gp(1, alpha)
        tau_hi = max_val - cls._gp(1 / d, alpha)
        f_lo = cls._p(X - tau_lo, alpha).sum(dim) - 1
        dm = tau_hi - tau_lo
        for it in range(n_iter):
            dm /= 2
            tau_m = tau_lo + dm
            p_m = cls._p(X - tau_m, alpha)
            f_m = p_m.sum(dim) - 1
            mask = (f_m * f_lo >= 0).unsqueeze(dim)
            tau_lo = torch.where(mask, tau_m, tau_lo)
        if ensure_sum_one:
            p_m /= p_m.sum(dim=dim).unsqueeze(dim=dim)
        ctx.save_for_backward(p_m)
        return p_m

    @classmethod
    def backward(cls, ctx, dY):
        Y, = ctx.saved_tensors
        gppr = torch.where(Y > 0, Y ** (2 - ctx.alpha), Y.new_zeros(1))
        dX = dY * gppr
        q = dX.sum(ctx.dim) / gppr.sum(ctx.dim)
        q = q.unsqueeze(ctx.dim)
        dX -= q * gppr
        d_alpha = None
        if ctx.needs_input_grad[1]:
            S = torch.where(Y > 0, Y * torch.log(Y), Y.new_zeros(1))
            ent = S.sum(ctx.dim).unsqueeze(ctx.dim)
            Y_skewed = gppr / gppr.sum(ctx.dim).unsqueeze(ctx.dim)
            d_alpha = dY * (Y - Y_skewed) / (ctx.alpha - 1) ** 2
            d_alpha -= dY * (S - Y_skewed * ent) / (ctx.alpha - 1)
            d_alpha = d_alpha.sum(ctx.dim).unsqueeze(ctx.dim)
        return dX, d_alpha, None, None, None


class SparsemaxBisectFunction(EntmaxBisectFunction):

    @classmethod
    def _gp(cls, x, alpha):
        return x

    @classmethod
    def _gp_inv(cls, y, alpha):
        return y

    @classmethod
    def _p(cls, x, alpha):
        return torch.clamp(x, min=0)

    @classmethod
    def forward(cls, ctx, X, dim=-1, n_iter=50, ensure_sum_one=True):
        return super().forward(ctx, X, alpha=2, dim=dim, n_iter=50,
            ensure_sum_one=True)

    @classmethod
    def backward(cls, ctx, dY):
        Y, = ctx.saved_tensors
        gppr = Y > 0
        dX = dY * gppr
        q = dX.sum(ctx.dim) / gppr.sum(ctx.dim)
        q = q.unsqueeze(ctx.dim)
        dX -= q * gppr
        return dX, None, None, None


class SparsemaxBisect(nn.Module):

    def __init__(self, dim=-1, n_iter=None):
        """sparsemax: normalizing sparse transform (a la softmax) via bisection

        Solves the projection:

            min_p ||x - p||_2   s.t.    p >= 0, sum(p) == 1.

        Parameters
        ----------
        dim : int
            The dimension along which to apply sparsemax.

        n_iter : int
            Number of bisection iterations. For float32, 24 iterations should
            suffice for machine precision.
        """
        self.dim = dim
        self.n_iter = n_iter
        super().__init__()

    def forward(self, X):
        return sparsemax_bisect(X, dim=self.dim, n_iter=self.n_iter)


def get_inputs():
    return [torch.rand([4, 4, 4, 4])]


def get_init_inputs():
    return [[], {}]

import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.autograd import Function
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0(in_out_ptr8,
    in_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp6 = triton_helpers.maximum(tmp4, tmp5)
    tmp7 = 1.0
    tmp8 = tmp6 - tmp7
    tmp9 = 0.25
    tmp10 = tmp6 - tmp9
    tmp11 = tmp10 - tmp8
    tmp12 = 0.5
    tmp13 = tmp11 * tmp12
    tmp14 = tmp8 + tmp13
    tmp15 = tmp0 - tmp14
    tmp16 = 0.0
    tmp17 = triton_helpers.maximum(tmp15, tmp16)
    tmp18 = tmp1 - tmp14
    tmp19 = triton_helpers.maximum(tmp18, tmp16)
    tmp20 = tmp17 + tmp19
    tmp21 = tmp3 - tmp14
    tmp22 = triton_helpers.maximum(tmp21, tmp16)
    tmp23 = tmp20 + tmp22
    tmp24 = tmp5 - tmp14
    tmp25 = triton_helpers.maximum(tmp24, tmp16)
    tmp26 = tmp23 + tmp25
    tmp27 = tmp26 - tmp7
    tmp28 = tmp0 - tmp8
    tmp29 = triton_helpers.maximum(tmp28, tmp16)
    tmp30 = tmp1 - tmp8
    tmp31 = triton_helpers.maximum(tmp30, tmp16)
    tmp32 = tmp29 + tmp31
    tmp33 = tmp3 - tmp8
    tmp34 = triton_helpers.maximum(tmp33, tmp16)
    tmp35 = tmp32 + tmp34
    tmp36 = tmp5 - tmp8
    tmp37 = triton_helpers.maximum(tmp36, tmp16)
    tmp38 = tmp35 + tmp37
    tmp39 = tmp38 - tmp7
    tmp40 = tmp27 * tmp39
    tmp41 = tmp40 >= tmp16
    tmp42 = tl.where(tmp41, tmp14, tmp8)
    tmp43 = tmp13 * tmp12
    tmp44 = tmp42 + tmp43
    tmp45 = tmp0 - tmp44
    tmp46 = triton_helpers.maximum(tmp45, tmp16)
    tmp47 = tmp1 - tmp44
    tmp48 = triton_helpers.maximum(tmp47, tmp16)
    tmp49 = tmp46 + tmp48
    tmp50 = tmp3 - tmp44
    tmp51 = triton_helpers.maximum(tmp50, tmp16)
    tmp52 = tmp49 + tmp51
    tmp53 = tmp5 - tmp44
    tmp54 = triton_helpers.maximum(tmp53, tmp16)
    tmp55 = tmp52 + tmp54
    tmp56 = tmp55 - tmp7
    tmp57 = tmp56 * tmp39
    tmp58 = tmp57 >= tmp16
    tmp59 = tl.where(tmp58, tmp44, tmp42)
    tmp60 = tmp43 * tmp12
    tmp61 = tmp59 + tmp60
    tmp62 = tmp0 - tmp61
    tmp63 = triton_helpers.maximum(tmp62, tmp16)
    tmp64 = tmp1 - tmp61
    tmp65 = triton_helpers.maximum(tmp64, tmp16)
    tmp66 = tmp63 + tmp65
    tmp67 = tmp3 - tmp61
    tmp68 = triton_helpers.maximum(tmp67, tmp16)
    tmp69 = tmp66 + tmp68
    tmp70 = tmp5 - tmp61
    tmp71 = triton_helpers.maximum(tmp70, tmp16)
    tmp72 = tmp69 + tmp71
    tmp73 = tmp72 - tmp7
    tmp74 = tmp73 * tmp39
    tmp75 = tmp74 >= tmp16
    tmp76 = tl.where(tmp75, tmp61, tmp59)
    tmp77 = tmp60 * tmp12
    tmp78 = tmp76 + tmp77
    tmp79 = tmp0 - tmp78
    tmp80 = triton_helpers.maximum(tmp79, tmp16)
    tmp81 = tmp1 - tmp78
    tmp82 = triton_helpers.maximum(tmp81, tmp16)
    tmp83 = tmp80 + tmp82
    tmp84 = tmp3 - tmp78
    tmp85 = triton_helpers.maximum(tmp84, tmp16)
    tmp86 = tmp83 + tmp85
    tmp87 = tmp5 - tmp78
    tmp88 = triton_helpers.maximum(tmp87, tmp16)
    tmp89 = tmp86 + tmp88
    tmp90 = tmp89 - tmp7
    tmp91 = tmp90 * tmp39
    tmp92 = tmp91 >= tmp16
    tmp93 = tl.where(tmp92, tmp78, tmp76)
    tmp94 = tmp77 * tmp12
    tmp95 = tmp93 + tmp94
    tmp96 = tmp0 - tmp95
    tmp97 = triton_helpers.maximum(tmp96, tmp16)
    tmp98 = tmp1 - tmp95
    tmp99 = triton_helpers.maximum(tmp98, tmp16)
    tmp100 = tmp97 + tmp99
    tmp101 = tmp3 - tmp95
    tmp102 = triton_helpers.maximum(tmp101, tmp16)
    tmp103 = tmp100 + tmp102
    tmp104 = tmp5 - tmp95
    tmp105 = triton_helpers.maximum(tmp104, tmp16)
    tmp106 = tmp103 + tmp105
    tmp107 = tmp106 - tmp7
    tmp108 = tmp107 * tmp39
    tmp109 = tmp108 >= tmp16
    tmp110 = tl.where(tmp109, tmp95, tmp93)
    tmp111 = tmp94 * tmp12
    tmp112 = tmp110 + tmp111
    tmp113 = tmp0 - tmp112
    tmp114 = triton_helpers.maximum(tmp113, tmp16)
    tmp115 = tmp1 - tmp112
    tmp116 = triton_helpers.maximum(tmp115, tmp16)
    tmp117 = tmp114 + tmp116
    tmp118 = tmp3 - tmp112
    tmp119 = triton_helpers.maximum(tmp118, tmp16)
    tmp120 = tmp117 + tmp119
    tmp121 = tmp5 - tmp112
    tmp122 = triton_helpers.maximum(tmp121, tmp16)
    tmp123 = tmp120 + tmp122
    tmp124 = tmp123 - tmp7
    tmp125 = tmp124 * tmp39
    tmp126 = tmp125 >= tmp16
    tmp127 = tl.where(tmp126, tmp112, tmp110)
    tmp128 = tmp111 * tmp12
    tmp129 = tmp127 + tmp128
    tmp130 = tmp0 - tmp129
    tmp131 = triton_helpers.maximum(tmp130, tmp16)
    tmp132 = tmp1 - tmp129
    tmp133 = triton_helpers.maximum(tmp132, tmp16)
    tmp134 = tmp131 + tmp133
    tmp135 = tmp3 - tmp129
    tmp136 = triton_helpers.maximum(tmp135, tmp16)
    tmp137 = tmp134 + tmp136
    tmp138 = tmp5 - tmp129
    tmp139 = triton_helpers.maximum(tmp138, tmp16)
    tmp140 = tmp137 + tmp139
    tmp141 = tmp140 - tmp7
    tmp142 = tmp141 * tmp39
    tmp143 = tmp142 >= tmp16
    tmp144 = tl.where(tmp143, tmp129, tmp127)
    tmp145 = tmp128 * tmp12
    tmp146 = tmp144 + tmp145
    tmp147 = tmp0 - tmp146
    tmp148 = triton_helpers.maximum(tmp147, tmp16)
    tmp149 = tmp1 - tmp146
    tmp150 = triton_helpers.maximum(tmp149, tmp16)
    tmp151 = tmp148 + tmp150
    tmp152 = tmp3 - tmp146
    tmp153 = triton_helpers.maximum(tmp152, tmp16)
    tmp154 = tmp151 + tmp153
    tmp155 = tmp5 - tmp146
    tmp156 = triton_helpers.maximum(tmp155, tmp16)
    tmp157 = tmp154 + tmp156
    tmp158 = tmp157 - tmp7
    tmp159 = tmp158 * tmp39
    tmp160 = tmp159 >= tmp16
    tmp161 = tl.where(tmp160, tmp146, tmp144)
    tmp162 = tmp145 * tmp12
    tmp163 = tmp161 + tmp162
    tmp164 = tmp0 - tmp163
    tmp165 = triton_helpers.maximum(tmp164, tmp16)
    tmp166 = tmp1 - tmp163
    tmp167 = triton_helpers.maximum(tmp166, tmp16)
    tmp168 = tmp165 + tmp167
    tmp169 = tmp3 - tmp163
    tmp170 = triton_helpers.maximum(tmp169, tmp16)
    tmp171 = tmp168 + tmp170
    tmp172 = tmp5 - tmp163
    tmp173 = triton_helpers.maximum(tmp172, tmp16)
    tmp174 = tmp171 + tmp173
    tmp175 = tmp174 - tmp7
    tmp176 = tmp175 * tmp39
    tmp177 = tmp176 >= tmp16
    tmp178 = tl.where(tmp177, tmp163, tmp161)
    tmp179 = tmp162 * tmp12
    tmp180 = tmp178 + tmp179
    tmp181 = tmp0 - tmp180
    tmp182 = triton_helpers.maximum(tmp181, tmp16)
    tmp183 = tmp1 - tmp180
    tmp184 = triton_helpers.maximum(tmp183, tmp16)
    tmp185 = tmp182 + tmp184
    tmp186 = tmp3 - tmp180
    tmp187 = triton_helpers.maximum(tmp186, tmp16)
    tmp188 = tmp185 + tmp187
    tmp189 = tmp5 - tmp180
    tmp190 = triton_helpers.maximum(tmp189, tmp16)
    tmp191 = tmp188 + tmp190
    tmp192 = tmp191 - tmp7
    tmp193 = tmp192 * tmp39
    tmp194 = tmp193 >= tmp16
    tmp195 = tl.where(tmp194, tmp180, tmp178)
    tmp196 = tmp179 * tmp12
    tmp197 = tmp195 + tmp196
    tmp198 = tmp0 - tmp197
    tmp199 = triton_helpers.maximum(tmp198, tmp16)
    tmp200 = tmp1 - tmp197
    tmp201 = triton_helpers.maximum(tmp200, tmp16)
    tmp202 = tmp199 + tmp201
    tmp203 = tmp3 - tmp197
    tmp204 = triton_helpers.maximum(tmp203, tmp16)
    tmp205 = tmp202 + tmp204
    tmp206 = tmp5 - tmp197
    tmp207 = triton_helpers.maximum(tmp206, tmp16)
    tmp208 = tmp205 + tmp207
    tmp209 = tmp208 - tmp7
    tmp210 = tmp209 * tmp39
    tmp211 = tmp210 >= tmp16
    tmp212 = tl.where(tmp211, tmp197, tmp195)
    tmp213 = tmp196 * tmp12
    tmp214 = tmp212 + tmp213
    tmp215 = tmp0 - tmp214
    tmp216 = triton_helpers.maximum(tmp215, tmp16)
    tmp217 = tmp1 - tmp214
    tmp218 = triton_helpers.maximum(tmp217, tmp16)
    tmp219 = tmp216 + tmp218
    tmp220 = tmp3 - tmp214
    tmp221 = triton_helpers.maximum(tmp220, tmp16)
    tmp222 = tmp219 + tmp221
    tmp223 = tmp5 - tmp214
    tmp224 = triton_helpers.maximum(tmp223, tmp16)
    tmp225 = tmp222 + tmp224
    tmp226 = tmp225 - tmp7
    tmp227 = tmp226 * tmp39
    tmp228 = tmp227 >= tmp16
    tmp229 = tl.where(tmp228, tmp214, tmp212)
    tmp230 = tmp213 * tmp12
    tmp231 = tmp229 + tmp230
    tmp232 = tmp0 - tmp231
    tmp233 = triton_helpers.maximum(tmp232, tmp16)
    tmp234 = tmp1 - tmp231
    tmp235 = triton_helpers.maximum(tmp234, tmp16)
    tmp236 = tmp233 + tmp235
    tmp237 = tmp3 - tmp231
    tmp238 = triton_helpers.maximum(tmp237, tmp16)
    tmp239 = tmp236 + tmp238
    tmp240 = tmp5 - tmp231
    tmp241 = triton_helpers.maximum(tmp240, tmp16)
    tmp242 = tmp239 + tmp241
    tmp243 = tmp242 - tmp7
    tmp244 = tmp243 * tmp39
    tmp245 = tmp244 >= tmp16
    tmp246 = tl.where(tmp245, tmp231, tmp229)
    tmp247 = tmp230 * tmp12
    tmp248 = tmp246 + tmp247
    tmp249 = tmp0 - tmp248
    tmp250 = triton_helpers.maximum(tmp249, tmp16)
    tmp251 = tmp1 - tmp248
    tmp252 = triton_helpers.maximum(tmp251, tmp16)
    tmp253 = tmp250 + tmp252
    tmp254 = tmp3 - tmp248
    tmp255 = triton_helpers.maximum(tmp254, tmp16)
    tmp256 = tmp253 + tmp255
    tmp257 = tmp5 - tmp248
    tmp258 = triton_helpers.maximum(tmp257, tmp16)
    tmp259 = tmp256 + tmp258
    tmp260 = tmp259 - tmp7
    tmp261 = tmp260 * tmp39
    tmp262 = tmp261 >= tmp16
    tmp263 = tl.where(tmp262, tmp248, tmp246)
    tmp264 = tmp247 * tmp12
    tmp265 = tmp263 + tmp264
    tmp266 = tmp0 - tmp265
    tmp267 = triton_helpers.maximum(tmp266, tmp16)
    tmp268 = tmp1 - tmp265
    tmp269 = triton_helpers.maximum(tmp268, tmp16)
    tmp270 = tmp267 + tmp269
    tmp271 = tmp3 - tmp265
    tmp272 = triton_helpers.maximum(tmp271, tmp16)
    tmp273 = tmp270 + tmp272
    tmp274 = tmp5 - tmp265
    tmp275 = triton_helpers.maximum(tmp274, tmp16)
    tmp276 = tmp273 + tmp275
    tmp277 = tmp276 - tmp7
    tmp278 = tmp277 * tmp39
    tmp279 = tmp278 >= tmp16
    tmp280 = tl.where(tmp279, tmp265, tmp263)
    tmp281 = tmp264 * tmp12
    tmp282 = tmp280 + tmp281
    tmp283 = tmp0 - tmp282
    tmp284 = triton_helpers.maximum(tmp283, tmp16)
    tmp285 = tmp1 - tmp282
    tmp286 = triton_helpers.maximum(tmp285, tmp16)
    tmp287 = tmp284 + tmp286
    tmp288 = tmp3 - tmp282
    tmp289 = triton_helpers.maximum(tmp288, tmp16)
    tmp290 = tmp287 + tmp289
    tmp291 = tmp5 - tmp282
    tmp292 = triton_helpers.maximum(tmp291, tmp16)
    tmp293 = tmp290 + tmp292
    tmp294 = tmp293 - tmp7
    tmp295 = tmp294 * tmp39
    tmp296 = tmp295 >= tmp16
    tmp297 = tl.where(tmp296, tmp282, tmp280)
    tmp298 = tmp281 * tmp12
    tmp299 = tmp297 + tmp298
    tmp300 = tmp0 - tmp299
    tmp301 = triton_helpers.maximum(tmp300, tmp16)
    tmp302 = tmp1 - tmp299
    tmp303 = triton_helpers.maximum(tmp302, tmp16)
    tmp304 = tmp301 + tmp303
    tmp305 = tmp3 - tmp299
    tmp306 = triton_helpers.maximum(tmp305, tmp16)
    tmp307 = tmp304 + tmp306
    tmp308 = tmp5 - tmp299
    tmp309 = triton_helpers.maximum(tmp308, tmp16)
    tmp310 = tmp307 + tmp309
    tmp311 = tmp310 - tmp7
    tmp312 = tmp311 * tmp39
    tmp313 = tmp312 >= tmp16
    tmp314 = tl.where(tmp313, tmp299, tmp297)
    tl.store(in_out_ptr8 + x0, tmp314, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1(in_out_ptr16,
    in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr1 + x0, xmask)
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp6 = triton_helpers.maximum(tmp4, tmp5)
    tmp7 = 0.25
    tmp8 = tmp6 - tmp7
    tmp9 = 1.0
    tmp10 = tmp6 - tmp9
    tmp11 = tmp8 - tmp10
    tmp12 = 0.5
    tmp13 = tmp11 * tmp12
    tmp14 = tmp13 * tmp12
    tmp15 = tmp14 * tmp12
    tmp16 = tmp15 * tmp12
    tmp17 = tmp16 * tmp12
    tmp18 = tmp17 * tmp12
    tmp19 = tmp18 * tmp12
    tmp20 = tmp19 * tmp12
    tmp21 = tmp20 * tmp12
    tmp22 = tmp21 * tmp12
    tmp23 = tmp22 * tmp12
    tmp24 = tmp23 * tmp12
    tmp25 = tmp24 * tmp12
    tmp26 = tmp25 * tmp12
    tmp27 = tmp26 * tmp12
    tmp28 = tmp27 * tmp12
    tmp29 = tmp28 * tmp12
    tmp30 = tmp29 * tmp12
    tmp32 = tmp31 + tmp30
    tmp33 = tmp0 - tmp32
    tmp34 = 0.0
    tmp35 = triton_helpers.maximum(tmp33, tmp34)
    tmp36 = tmp1 - tmp32
    tmp37 = triton_helpers.maximum(tmp36, tmp34)
    tmp38 = tmp35 + tmp37
    tmp39 = tmp3 - tmp32
    tmp40 = triton_helpers.maximum(tmp39, tmp34)
    tmp41 = tmp38 + tmp40
    tmp42 = tmp5 - tmp32
    tmp43 = triton_helpers.maximum(tmp42, tmp34)
    tmp44 = tmp41 + tmp43
    tmp45 = tmp44 - tmp9
    tmp46 = tmp0 - tmp10
    tmp47 = triton_helpers.maximum(tmp46, tmp34)
    tmp48 = tmp1 - tmp10
    tmp49 = triton_helpers.maximum(tmp48, tmp34)
    tmp50 = tmp47 + tmp49
    tmp51 = tmp3 - tmp10
    tmp52 = triton_helpers.maximum(tmp51, tmp34)
    tmp53 = tmp50 + tmp52
    tmp54 = tmp5 - tmp10
    tmp55 = triton_helpers.maximum(tmp54, tmp34)
    tmp56 = tmp53 + tmp55
    tmp57 = tmp56 - tmp9
    tmp58 = tmp45 * tmp57
    tmp59 = tmp58 >= tmp34
    tmp60 = tl.where(tmp59, tmp32, tmp31)
    tmp61 = tmp30 * tmp12
    tmp62 = tmp60 + tmp61
    tmp63 = tmp0 - tmp62
    tmp64 = triton_helpers.maximum(tmp63, tmp34)
    tmp65 = tmp1 - tmp62
    tmp66 = triton_helpers.maximum(tmp65, tmp34)
    tmp67 = tmp64 + tmp66
    tmp68 = tmp3 - tmp62
    tmp69 = triton_helpers.maximum(tmp68, tmp34)
    tmp70 = tmp67 + tmp69
    tmp71 = tmp5 - tmp62
    tmp72 = triton_helpers.maximum(tmp71, tmp34)
    tmp73 = tmp70 + tmp72
    tmp74 = tmp73 - tmp9
    tmp75 = tmp74 * tmp57
    tmp76 = tmp75 >= tmp34
    tmp77 = tl.where(tmp76, tmp62, tmp60)
    tmp78 = tmp61 * tmp12
    tmp79 = tmp77 + tmp78
    tmp80 = tmp0 - tmp79
    tmp81 = triton_helpers.maximum(tmp80, tmp34)
    tmp82 = tmp1 - tmp79
    tmp83 = triton_helpers.maximum(tmp82, tmp34)
    tmp84 = tmp81 + tmp83
    tmp85 = tmp3 - tmp79
    tmp86 = triton_helpers.maximum(tmp85, tmp34)
    tmp87 = tmp84 + tmp86
    tmp88 = tmp5 - tmp79
    tmp89 = triton_helpers.maximum(tmp88, tmp34)
    tmp90 = tmp87 + tmp89
    tmp91 = tmp90 - tmp9
    tmp92 = tmp91 * tmp57
    tmp93 = tmp92 >= tmp34
    tmp94 = tl.where(tmp93, tmp79, tmp77)
    tmp95 = tmp78 * tmp12
    tmp96 = tmp94 + tmp95
    tmp97 = tmp0 - tmp96
    tmp98 = triton_helpers.maximum(tmp97, tmp34)
    tmp99 = tmp1 - tmp96
    tmp100 = triton_helpers.maximum(tmp99, tmp34)
    tmp101 = tmp98 + tmp100
    tmp102 = tmp3 - tmp96
    tmp103 = triton_helpers.maximum(tmp102, tmp34)
    tmp104 = tmp101 + tmp103
    tmp105 = tmp5 - tmp96
    tmp106 = triton_helpers.maximum(tmp105, tmp34)
    tmp107 = tmp104 + tmp106
    tmp108 = tmp107 - tmp9
    tmp109 = tmp108 * tmp57
    tmp110 = tmp109 >= tmp34
    tmp111 = tl.where(tmp110, tmp96, tmp94)
    tmp112 = tmp95 * tmp12
    tmp113 = tmp111 + tmp112
    tmp114 = tmp0 - tmp113
    tmp115 = triton_helpers.maximum(tmp114, tmp34)
    tmp116 = tmp1 - tmp113
    tmp117 = triton_helpers.maximum(tmp116, tmp34)
    tmp118 = tmp115 + tmp117
    tmp119 = tmp3 - tmp113
    tmp120 = triton_helpers.maximum(tmp119, tmp34)
    tmp121 = tmp118 + tmp120
    tmp122 = tmp5 - tmp113
    tmp123 = triton_helpers.maximum(tmp122, tmp34)
    tmp124 = tmp121 + tmp123
    tmp125 = tmp124 - tmp9
    tmp126 = tmp125 * tmp57
    tmp127 = tmp126 >= tmp34
    tmp128 = tl.where(tmp127, tmp113, tmp111)
    tmp129 = tmp112 * tmp12
    tmp130 = tmp128 + tmp129
    tmp131 = tmp0 - tmp130
    tmp132 = triton_helpers.maximum(tmp131, tmp34)
    tmp133 = tmp1 - tmp130
    tmp134 = triton_helpers.maximum(tmp133, tmp34)
    tmp135 = tmp132 + tmp134
    tmp136 = tmp3 - tmp130
    tmp137 = triton_helpers.maximum(tmp136, tmp34)
    tmp138 = tmp135 + tmp137
    tmp139 = tmp5 - tmp130
    tmp140 = triton_helpers.maximum(tmp139, tmp34)
    tmp141 = tmp138 + tmp140
    tmp142 = tmp141 - tmp9
    tmp143 = tmp142 * tmp57
    tmp144 = tmp143 >= tmp34
    tmp145 = tl.where(tmp144, tmp130, tmp128)
    tmp146 = tmp129 * tmp12
    tmp147 = tmp145 + tmp146
    tmp148 = tmp0 - tmp147
    tmp149 = triton_helpers.maximum(tmp148, tmp34)
    tmp150 = tmp1 - tmp147
    tmp151 = triton_helpers.maximum(tmp150, tmp34)
    tmp152 = tmp149 + tmp151
    tmp153 = tmp3 - tmp147
    tmp154 = triton_helpers.maximum(tmp153, tmp34)
    tmp155 = tmp152 + tmp154
    tmp156 = tmp5 - tmp147
    tmp157 = triton_helpers.maximum(tmp156, tmp34)
    tmp158 = tmp155 + tmp157
    tmp159 = tmp158 - tmp9
    tmp160 = tmp159 * tmp57
    tmp161 = tmp160 >= tmp34
    tmp162 = tl.where(tmp161, tmp147, tmp145)
    tmp163 = tmp146 * tmp12
    tmp164 = tmp162 + tmp163
    tmp165 = tmp0 - tmp164
    tmp166 = triton_helpers.maximum(tmp165, tmp34)
    tmp167 = tmp1 - tmp164
    tmp168 = triton_helpers.maximum(tmp167, tmp34)
    tmp169 = tmp166 + tmp168
    tmp170 = tmp3 - tmp164
    tmp171 = triton_helpers.maximum(tmp170, tmp34)
    tmp172 = tmp169 + tmp171
    tmp173 = tmp5 - tmp164
    tmp174 = triton_helpers.maximum(tmp173, tmp34)
    tmp175 = tmp172 + tmp174
    tmp176 = tmp175 - tmp9
    tmp177 = tmp176 * tmp57
    tmp178 = tmp177 >= tmp34
    tmp179 = tl.where(tmp178, tmp164, tmp162)
    tmp180 = tmp163 * tmp12
    tmp181 = tmp179 + tmp180
    tmp182 = tmp0 - tmp181
    tmp183 = triton_helpers.maximum(tmp182, tmp34)
    tmp184 = tmp1 - tmp181
    tmp185 = triton_helpers.maximum(tmp184, tmp34)
    tmp186 = tmp183 + tmp185
    tmp187 = tmp3 - tmp181
    tmp188 = triton_helpers.maximum(tmp187, tmp34)
    tmp189 = tmp186 + tmp188
    tmp190 = tmp5 - tmp181
    tmp191 = triton_helpers.maximum(tmp190, tmp34)
    tmp192 = tmp189 + tmp191
    tmp193 = tmp192 - tmp9
    tmp194 = tmp193 * tmp57
    tmp195 = tmp194 >= tmp34
    tmp196 = tl.where(tmp195, tmp181, tmp179)
    tmp197 = tmp180 * tmp12
    tmp198 = tmp196 + tmp197
    tmp199 = tmp0 - tmp198
    tmp200 = triton_helpers.maximum(tmp199, tmp34)
    tmp201 = tmp1 - tmp198
    tmp202 = triton_helpers.maximum(tmp201, tmp34)
    tmp203 = tmp200 + tmp202
    tmp204 = tmp3 - tmp198
    tmp205 = triton_helpers.maximum(tmp204, tmp34)
    tmp206 = tmp203 + tmp205
    tmp207 = tmp5 - tmp198
    tmp208 = triton_helpers.maximum(tmp207, tmp34)
    tmp209 = tmp206 + tmp208
    tmp210 = tmp209 - tmp9
    tmp211 = tmp210 * tmp57
    tmp212 = tmp211 >= tmp34
    tmp213 = tl.where(tmp212, tmp198, tmp196)
    tmp214 = tmp197 * tmp12
    tmp215 = tmp213 + tmp214
    tmp216 = tmp0 - tmp215
    tmp217 = triton_helpers.maximum(tmp216, tmp34)
    tmp218 = tmp1 - tmp215
    tmp219 = triton_helpers.maximum(tmp218, tmp34)
    tmp220 = tmp217 + tmp219
    tmp221 = tmp3 - tmp215
    tmp222 = triton_helpers.maximum(tmp221, tmp34)
    tmp223 = tmp220 + tmp222
    tmp224 = tmp5 - tmp215
    tmp225 = triton_helpers.maximum(tmp224, tmp34)
    tmp226 = tmp223 + tmp225
    tmp227 = tmp226 - tmp9
    tmp228 = tmp227 * tmp57
    tmp229 = tmp228 >= tmp34
    tmp230 = tl.where(tmp229, tmp215, tmp213)
    tmp231 = tmp214 * tmp12
    tmp232 = tmp230 + tmp231
    tmp233 = tmp0 - tmp232
    tmp234 = triton_helpers.maximum(tmp233, tmp34)
    tmp235 = tmp1 - tmp232
    tmp236 = triton_helpers.maximum(tmp235, tmp34)
    tmp237 = tmp234 + tmp236
    tmp238 = tmp3 - tmp232
    tmp239 = triton_helpers.maximum(tmp238, tmp34)
    tmp240 = tmp237 + tmp239
    tmp241 = tmp5 - tmp232
    tmp242 = triton_helpers.maximum(tmp241, tmp34)
    tmp243 = tmp240 + tmp242
    tmp244 = tmp243 - tmp9
    tmp245 = tmp244 * tmp57
    tmp246 = tmp245 >= tmp34
    tmp247 = tl.where(tmp246, tmp232, tmp230)
    tmp248 = tmp231 * tmp12
    tmp249 = tmp247 + tmp248
    tmp250 = tmp0 - tmp249
    tmp251 = triton_helpers.maximum(tmp250, tmp34)
    tmp252 = tmp1 - tmp249
    tmp253 = triton_helpers.maximum(tmp252, tmp34)
    tmp254 = tmp251 + tmp253
    tmp255 = tmp3 - tmp249
    tmp256 = triton_helpers.maximum(tmp255, tmp34)
    tmp257 = tmp254 + tmp256
    tmp258 = tmp5 - tmp249
    tmp259 = triton_helpers.maximum(tmp258, tmp34)
    tmp260 = tmp257 + tmp259
    tmp261 = tmp260 - tmp9
    tmp262 = tmp261 * tmp57
    tmp263 = tmp262 >= tmp34
    tmp264 = tl.where(tmp263, tmp249, tmp247)
    tmp265 = tmp248 * tmp12
    tmp266 = tmp264 + tmp265
    tmp267 = tmp0 - tmp266
    tmp268 = triton_helpers.maximum(tmp267, tmp34)
    tmp269 = tmp1 - tmp266
    tmp270 = triton_helpers.maximum(tmp269, tmp34)
    tmp271 = tmp268 + tmp270
    tmp272 = tmp3 - tmp266
    tmp273 = triton_helpers.maximum(tmp272, tmp34)
    tmp274 = tmp271 + tmp273
    tmp275 = tmp5 - tmp266
    tmp276 = triton_helpers.maximum(tmp275, tmp34)
    tmp277 = tmp274 + tmp276
    tmp278 = tmp277 - tmp9
    tmp279 = tmp278 * tmp57
    tmp280 = tmp279 >= tmp34
    tmp281 = tl.where(tmp280, tmp266, tmp264)
    tmp282 = tmp265 * tmp12
    tmp283 = tmp281 + tmp282
    tmp284 = tmp0 - tmp283
    tmp285 = triton_helpers.maximum(tmp284, tmp34)
    tmp286 = tmp1 - tmp283
    tmp287 = triton_helpers.maximum(tmp286, tmp34)
    tmp288 = tmp285 + tmp287
    tmp289 = tmp3 - tmp283
    tmp290 = triton_helpers.maximum(tmp289, tmp34)
    tmp291 = tmp288 + tmp290
    tmp292 = tmp5 - tmp283
    tmp293 = triton_helpers.maximum(tmp292, tmp34)
    tmp294 = tmp291 + tmp293
    tmp295 = tmp294 - tmp9
    tmp296 = tmp295 * tmp57
    tmp297 = tmp296 >= tmp34
    tmp298 = tl.where(tmp297, tmp283, tmp281)
    tmp299 = tmp282 * tmp12
    tmp300 = tmp298 + tmp299
    tmp301 = tmp0 - tmp300
    tmp302 = triton_helpers.maximum(tmp301, tmp34)
    tmp303 = tmp1 - tmp300
    tmp304 = triton_helpers.maximum(tmp303, tmp34)
    tmp305 = tmp302 + tmp304
    tmp306 = tmp3 - tmp300
    tmp307 = triton_helpers.maximum(tmp306, tmp34)
    tmp308 = tmp305 + tmp307
    tmp309 = tmp5 - tmp300
    tmp310 = triton_helpers.maximum(tmp309, tmp34)
    tmp311 = tmp308 + tmp310
    tmp312 = tmp311 - tmp9
    tmp313 = tmp312 * tmp57
    tmp314 = tmp313 >= tmp34
    tmp315 = tl.where(tmp314, tmp300, tmp298)
    tmp316 = tmp299 * tmp12
    tmp317 = tmp315 + tmp316
    tmp318 = tmp0 - tmp317
    tmp319 = triton_helpers.maximum(tmp318, tmp34)
    tmp320 = tmp1 - tmp317
    tmp321 = triton_helpers.maximum(tmp320, tmp34)
    tmp322 = tmp319 + tmp321
    tmp323 = tmp3 - tmp317
    tmp324 = triton_helpers.maximum(tmp323, tmp34)
    tmp325 = tmp322 + tmp324
    tmp326 = tmp5 - tmp317
    tmp327 = triton_helpers.maximum(tmp326, tmp34)
    tmp328 = tmp325 + tmp327
    tmp329 = tmp328 - tmp9
    tmp330 = tmp329 * tmp57
    tmp331 = tmp330 >= tmp34
    tmp332 = tl.where(tmp331, tmp317, tmp315)
    tmp333 = tmp316 * tmp12
    tmp334 = tmp332 + tmp333
    tmp335 = tmp0 - tmp334
    tmp336 = triton_helpers.maximum(tmp335, tmp34)
    tmp337 = tmp1 - tmp334
    tmp338 = triton_helpers.maximum(tmp337, tmp34)
    tmp339 = tmp336 + tmp338
    tmp340 = tmp3 - tmp334
    tmp341 = triton_helpers.maximum(tmp340, tmp34)
    tmp342 = tmp339 + tmp341
    tmp343 = tmp5 - tmp334
    tmp344 = triton_helpers.maximum(tmp343, tmp34)
    tmp345 = tmp342 + tmp344
    tmp346 = tmp345 - tmp9
    tmp347 = tmp346 * tmp57
    tmp348 = tmp347 >= tmp34
    tmp349 = tl.where(tmp348, tmp334, tmp332)
    tmp350 = tmp333 * tmp12
    tmp351 = tmp349 + tmp350
    tmp352 = tmp0 - tmp351
    tmp353 = triton_helpers.maximum(tmp352, tmp34)
    tmp354 = tmp1 - tmp351
    tmp355 = triton_helpers.maximum(tmp354, tmp34)
    tmp356 = tmp353 + tmp355
    tmp357 = tmp3 - tmp351
    tmp358 = triton_helpers.maximum(tmp357, tmp34)
    tmp359 = tmp356 + tmp358
    tmp360 = tmp5 - tmp351
    tmp361 = triton_helpers.maximum(tmp360, tmp34)
    tmp362 = tmp359 + tmp361
    tmp363 = tmp362 - tmp9
    tmp364 = tmp363 * tmp57
    tmp365 = tmp364 >= tmp34
    tmp366 = tl.where(tmp365, tmp351, tmp349)
    tmp367 = tmp350 * tmp12
    tmp368 = tmp366 + tmp367
    tmp369 = tmp0 - tmp368
    tmp370 = triton_helpers.maximum(tmp369, tmp34)
    tmp371 = tmp1 - tmp368
    tmp372 = triton_helpers.maximum(tmp371, tmp34)
    tmp373 = tmp370 + tmp372
    tmp374 = tmp3 - tmp368
    tmp375 = triton_helpers.maximum(tmp374, tmp34)
    tmp376 = tmp373 + tmp375
    tmp377 = tmp5 - tmp368
    tmp378 = triton_helpers.maximum(tmp377, tmp34)
    tmp379 = tmp376 + tmp378
    tmp380 = tmp379 - tmp9
    tmp381 = tmp380 * tmp57
    tmp382 = tmp381 >= tmp34
    tmp383 = tl.where(tmp382, tmp368, tmp366)
    tmp384 = tmp367 * tmp12
    tmp385 = tmp383 + tmp384
    tmp386 = tmp0 - tmp385
    tmp387 = triton_helpers.maximum(tmp386, tmp34)
    tmp388 = tmp1 - tmp385
    tmp389 = triton_helpers.maximum(tmp388, tmp34)
    tmp390 = tmp387 + tmp389
    tmp391 = tmp3 - tmp385
    tmp392 = triton_helpers.maximum(tmp391, tmp34)
    tmp393 = tmp390 + tmp392
    tmp394 = tmp5 - tmp385
    tmp395 = triton_helpers.maximum(tmp394, tmp34)
    tmp396 = tmp393 + tmp395
    tmp397 = tmp396 - tmp9
    tmp398 = tmp397 * tmp57
    tmp399 = tmp398 >= tmp34
    tmp400 = tl.where(tmp399, tmp385, tmp383)
    tmp401 = tmp384 * tmp12
    tmp402 = tmp400 + tmp401
    tmp403 = tmp0 - tmp402
    tmp404 = triton_helpers.maximum(tmp403, tmp34)
    tmp405 = tmp1 - tmp402
    tmp406 = triton_helpers.maximum(tmp405, tmp34)
    tmp407 = tmp404 + tmp406
    tmp408 = tmp3 - tmp402
    tmp409 = triton_helpers.maximum(tmp408, tmp34)
    tmp410 = tmp407 + tmp409
    tmp411 = tmp5 - tmp402
    tmp412 = triton_helpers.maximum(tmp411, tmp34)
    tmp413 = tmp410 + tmp412
    tmp414 = tmp413 - tmp9
    tmp415 = tmp414 * tmp57
    tmp416 = tmp415 >= tmp34
    tmp417 = tl.where(tmp416, tmp402, tmp400)
    tmp418 = tmp401 * tmp12
    tmp419 = tmp417 + tmp418
    tmp420 = tmp0 - tmp419
    tmp421 = triton_helpers.maximum(tmp420, tmp34)
    tmp422 = tmp1 - tmp419
    tmp423 = triton_helpers.maximum(tmp422, tmp34)
    tmp424 = tmp421 + tmp423
    tmp425 = tmp3 - tmp419
    tmp426 = triton_helpers.maximum(tmp425, tmp34)
    tmp427 = tmp424 + tmp426
    tmp428 = tmp5 - tmp419
    tmp429 = triton_helpers.maximum(tmp428, tmp34)
    tmp430 = tmp427 + tmp429
    tmp431 = tmp430 - tmp9
    tmp432 = tmp431 * tmp57
    tmp433 = tmp432 >= tmp34
    tmp434 = tl.where(tmp433, tmp419, tmp417)
    tl.store(out_ptr0 + x0, tmp30, xmask)
    tl.store(in_out_ptr16 + x0, tmp434, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_sub_2(in_ptr0, in_ptr1, in_ptr2,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp1 + tmp26
    tmp28 = tmp0 - tmp27
    tmp29 = 0.0
    tmp30 = triton_helpers.maximum(tmp28, tmp29)
    tl.store(out_ptr0 + x2, tmp30, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3(in_out_ptr0,
    in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp12 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp14 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp32 = tl.load(in_out_ptr0 + x0, xmask)
    tmp33 = tl.load(in_ptr2 + x0, xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 1.0
    tmp8 = tmp6 - tmp7
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp13 = triton_helpers.maximum(tmp11, tmp12)
    tmp15 = triton_helpers.maximum(tmp13, tmp14)
    tmp16 = tmp15 - tmp7
    tmp17 = tmp9 - tmp16
    tmp18 = 0.0
    tmp19 = triton_helpers.maximum(tmp17, tmp18)
    tmp20 = tmp10 - tmp16
    tmp21 = triton_helpers.maximum(tmp20, tmp18)
    tmp22 = tmp19 + tmp21
    tmp23 = tmp12 - tmp16
    tmp24 = triton_helpers.maximum(tmp23, tmp18)
    tmp25 = tmp22 + tmp24
    tmp26 = tmp14 - tmp16
    tmp27 = triton_helpers.maximum(tmp26, tmp18)
    tmp28 = tmp25 + tmp27
    tmp29 = tmp28 - tmp7
    tmp30 = tmp8 * tmp29
    tmp31 = tmp30 >= tmp18
    tmp34 = 0.5
    tmp35 = tmp33 * tmp34
    tmp36 = tmp35 * tmp34
    tmp37 = tmp36 * tmp34
    tmp38 = tmp37 * tmp34
    tmp39 = tmp38 * tmp34
    tmp40 = tmp39 * tmp34
    tmp41 = tmp40 * tmp34
    tmp42 = tmp41 * tmp34
    tmp43 = tmp42 * tmp34
    tmp44 = tmp43 * tmp34
    tmp45 = tmp44 * tmp34
    tmp46 = tmp45 * tmp34
    tmp47 = tmp46 * tmp34
    tmp48 = tmp47 * tmp34
    tmp49 = tmp48 * tmp34
    tmp50 = tmp49 * tmp34
    tmp51 = tmp50 * tmp34
    tmp52 = tmp51 * tmp34
    tmp53 = tmp52 * tmp34
    tmp54 = tmp53 * tmp34
    tmp55 = tmp54 * tmp34
    tmp56 = tmp55 * tmp34
    tmp57 = tmp56 * tmp34
    tmp58 = tmp32 + tmp57
    tmp59 = tl.where(tmp31, tmp58, tmp32)
    tl.store(in_out_ptr0 + x0, tmp59, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_sub_4(in_ptr0, in_ptr1, in_ptr2,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp26 * tmp3
    tmp28 = tmp1 + tmp27
    tmp29 = tmp0 - tmp28
    tmp30 = 0.0
    tmp31 = triton_helpers.maximum(tmp29, tmp30)
    tl.store(out_ptr0 + x2, tmp31, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5(in_out_ptr0,
    in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp12 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp14 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp32 = tl.load(in_out_ptr0 + x0, xmask)
    tmp33 = tl.load(in_ptr2 + x0, xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 1.0
    tmp8 = tmp6 - tmp7
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp13 = triton_helpers.maximum(tmp11, tmp12)
    tmp15 = triton_helpers.maximum(tmp13, tmp14)
    tmp16 = tmp15 - tmp7
    tmp17 = tmp9 - tmp16
    tmp18 = 0.0
    tmp19 = triton_helpers.maximum(tmp17, tmp18)
    tmp20 = tmp10 - tmp16
    tmp21 = triton_helpers.maximum(tmp20, tmp18)
    tmp22 = tmp19 + tmp21
    tmp23 = tmp12 - tmp16
    tmp24 = triton_helpers.maximum(tmp23, tmp18)
    tmp25 = tmp22 + tmp24
    tmp26 = tmp14 - tmp16
    tmp27 = triton_helpers.maximum(tmp26, tmp18)
    tmp28 = tmp25 + tmp27
    tmp29 = tmp28 - tmp7
    tmp30 = tmp8 * tmp29
    tmp31 = tmp30 >= tmp18
    tmp34 = 0.5
    tmp35 = tmp33 * tmp34
    tmp36 = tmp35 * tmp34
    tmp37 = tmp36 * tmp34
    tmp38 = tmp37 * tmp34
    tmp39 = tmp38 * tmp34
    tmp40 = tmp39 * tmp34
    tmp41 = tmp40 * tmp34
    tmp42 = tmp41 * tmp34
    tmp43 = tmp42 * tmp34
    tmp44 = tmp43 * tmp34
    tmp45 = tmp44 * tmp34
    tmp46 = tmp45 * tmp34
    tmp47 = tmp46 * tmp34
    tmp48 = tmp47 * tmp34
    tmp49 = tmp48 * tmp34
    tmp50 = tmp49 * tmp34
    tmp51 = tmp50 * tmp34
    tmp52 = tmp51 * tmp34
    tmp53 = tmp52 * tmp34
    tmp54 = tmp53 * tmp34
    tmp55 = tmp54 * tmp34
    tmp56 = tmp55 * tmp34
    tmp57 = tmp56 * tmp34
    tmp58 = tmp57 * tmp34
    tmp59 = tmp32 + tmp58
    tmp60 = tl.where(tmp31, tmp59, tmp32)
    tl.store(in_out_ptr0 + x0, tmp60, xmask)


@triton.jit
def triton_poi_fused_add_div_sub_6(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp26 * tmp3
    tmp28 = tmp27 * tmp3
    tmp29 = tmp1 + tmp28
    tmp30 = tmp0 - tmp29
    tl.store(out_ptr0 + x2, tmp30, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7(in_out_ptr0,
    in_ptr0, in_ptr1, in_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp17 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp19 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp36 = tl.load(in_out_ptr0 + x0, xmask)
    tmp37 = tl.load(in_ptr2 + x0, xmask)
    tmp1 = 0.0
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp3, tmp1)
    tmp5 = tmp2 + tmp4
    tmp7 = triton_helpers.maximum(tmp6, tmp1)
    tmp8 = tmp5 + tmp7
    tmp10 = triton_helpers.maximum(tmp9, tmp1)
    tmp11 = tmp8 + tmp10
    tmp12 = 1.0
    tmp13 = tmp11 - tmp12
    tmp16 = triton_helpers.maximum(tmp14, tmp15)
    tmp18 = triton_helpers.maximum(tmp16, tmp17)
    tmp20 = triton_helpers.maximum(tmp18, tmp19)
    tmp21 = tmp20 - tmp12
    tmp22 = tmp14 - tmp21
    tmp23 = triton_helpers.maximum(tmp22, tmp1)
    tmp24 = tmp15 - tmp21
    tmp25 = triton_helpers.maximum(tmp24, tmp1)
    tmp26 = tmp23 + tmp25
    tmp27 = tmp17 - tmp21
    tmp28 = triton_helpers.maximum(tmp27, tmp1)
    tmp29 = tmp26 + tmp28
    tmp30 = tmp19 - tmp21
    tmp31 = triton_helpers.maximum(tmp30, tmp1)
    tmp32 = tmp29 + tmp31
    tmp33 = tmp32 - tmp12
    tmp34 = tmp13 * tmp33
    tmp35 = tmp34 >= tmp1
    tmp38 = 0.5
    tmp39 = tmp37 * tmp38
    tmp40 = tmp39 * tmp38
    tmp41 = tmp40 * tmp38
    tmp42 = tmp41 * tmp38
    tmp43 = tmp42 * tmp38
    tmp44 = tmp43 * tmp38
    tmp45 = tmp44 * tmp38
    tmp46 = tmp45 * tmp38
    tmp47 = tmp46 * tmp38
    tmp48 = tmp47 * tmp38
    tmp49 = tmp48 * tmp38
    tmp50 = tmp49 * tmp38
    tmp51 = tmp50 * tmp38
    tmp52 = tmp51 * tmp38
    tmp53 = tmp52 * tmp38
    tmp54 = tmp53 * tmp38
    tmp55 = tmp54 * tmp38
    tmp56 = tmp55 * tmp38
    tmp57 = tmp56 * tmp38
    tmp58 = tmp57 * tmp38
    tmp59 = tmp58 * tmp38
    tmp60 = tmp59 * tmp38
    tmp61 = tmp60 * tmp38
    tmp62 = tmp61 * tmp38
    tmp63 = tmp62 * tmp38
    tmp64 = tmp36 + tmp63
    tmp65 = tl.where(tmp35, tmp64, tmp36)
    tl.store(in_out_ptr0 + x0, tmp65, xmask)


@triton.jit
def triton_poi_fused_add_div_sub_8(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp6 * tmp3
    tmp8 = tmp7 * tmp3
    tmp9 = tmp8 * tmp3
    tmp10 = tmp9 * tmp3
    tmp11 = tmp10 * tmp3
    tmp12 = tmp11 * tmp3
    tmp13 = tmp12 * tmp3
    tmp14 = tmp13 * tmp3
    tmp15 = tmp14 * tmp3
    tmp16 = tmp15 * tmp3
    tmp17 = tmp16 * tmp3
    tmp18 = tmp17 * tmp3
    tmp19 = tmp18 * tmp3
    tmp20 = tmp19 * tmp3
    tmp21 = tmp20 * tmp3
    tmp22 = tmp21 * tmp3
    tmp23 = tmp22 * tmp3
    tmp24 = tmp23 * tmp3
    tmp25 = tmp24 * tmp3
    tmp26 = tmp25 * tmp3
    tmp27 = tmp26 * tmp3
    tmp28 = tmp27 * tmp3
    tmp29 = tmp28 * tmp3
    tmp30 = tmp1 + tmp29
    tmp31 = tmp0 - tmp30
    tl.store(out_ptr0 + x2, tmp31, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9(in_out_ptr0,
    in_out_ptr2, in_ptr0, in_ptr1, in_ptr2, out_ptr4, out_ptr7, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp17 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp19 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp36 = tl.load(in_out_ptr0 + x0, xmask)
    tmp37 = tl.load(in_ptr2 + x0, xmask)
    tmp1 = 0.0
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp3, tmp1)
    tmp5 = tmp2 + tmp4
    tmp7 = triton_helpers.maximum(tmp6, tmp1)
    tmp8 = tmp5 + tmp7
    tmp10 = triton_helpers.maximum(tmp9, tmp1)
    tmp11 = tmp8 + tmp10
    tmp12 = 1.0
    tmp13 = tmp11 - tmp12
    tmp16 = triton_helpers.maximum(tmp14, tmp15)
    tmp18 = triton_helpers.maximum(tmp16, tmp17)
    tmp20 = triton_helpers.maximum(tmp18, tmp19)
    tmp21 = tmp20 - tmp12
    tmp22 = tmp14 - tmp21
    tmp23 = triton_helpers.maximum(tmp22, tmp1)
    tmp24 = tmp15 - tmp21
    tmp25 = triton_helpers.maximum(tmp24, tmp1)
    tmp26 = tmp23 + tmp25
    tmp27 = tmp17 - tmp21
    tmp28 = triton_helpers.maximum(tmp27, tmp1)
    tmp29 = tmp26 + tmp28
    tmp30 = tmp19 - tmp21
    tmp31 = triton_helpers.maximum(tmp30, tmp1)
    tmp32 = tmp29 + tmp31
    tmp33 = tmp32 - tmp12
    tmp34 = tmp13 * tmp33
    tmp35 = tmp34 >= tmp1
    tmp38 = 0.5
    tmp39 = tmp37 * tmp38
    tmp40 = tmp39 * tmp38
    tmp41 = tmp40 * tmp38
    tmp42 = tmp41 * tmp38
    tmp43 = tmp42 * tmp38
    tmp44 = tmp43 * tmp38
    tmp45 = tmp44 * tmp38
    tmp46 = tmp45 * tmp38
    tmp47 = tmp46 * tmp38
    tmp48 = tmp47 * tmp38
    tmp49 = tmp48 * tmp38
    tmp50 = tmp49 * tmp38
    tmp51 = tmp50 * tmp38
    tmp52 = tmp51 * tmp38
    tmp53 = tmp52 * tmp38
    tmp54 = tmp53 * tmp38
    tmp55 = tmp54 * tmp38
    tmp56 = tmp55 * tmp38
    tmp57 = tmp56 * tmp38
    tmp58 = tmp57 * tmp38
    tmp59 = tmp58 * tmp38
    tmp60 = tmp59 * tmp38
    tmp61 = tmp60 * tmp38
    tmp62 = tmp61 * tmp38
    tmp63 = tmp62 * tmp38
    tmp64 = tmp63 * tmp38
    tmp65 = tmp36 + tmp64
    tmp66 = tl.where(tmp35, tmp65, tmp36)
    tmp67 = tmp64 * tmp38
    tmp68 = tmp66 + tmp67
    tmp69 = tmp14 - tmp68
    tmp70 = triton_helpers.maximum(tmp69, tmp1)
    tmp71 = tmp15 - tmp68
    tmp72 = triton_helpers.maximum(tmp71, tmp1)
    tmp73 = tmp70 + tmp72
    tmp74 = tmp17 - tmp68
    tmp75 = triton_helpers.maximum(tmp74, tmp1)
    tmp76 = tmp73 + tmp75
    tmp77 = tmp19 - tmp68
    tmp78 = triton_helpers.maximum(tmp77, tmp1)
    tmp79 = tmp76 + tmp78
    tmp80 = tmp79 - tmp12
    tmp81 = tmp80 * tmp33
    tmp82 = tmp81 >= tmp1
    tmp83 = tl.where(tmp82, tmp68, tmp66)
    tmp84 = tmp67 * tmp38
    tmp85 = tmp83 + tmp84
    tmp86 = tmp14 - tmp85
    tmp87 = triton_helpers.maximum(tmp86, tmp1)
    tmp88 = tmp15 - tmp85
    tmp89 = triton_helpers.maximum(tmp88, tmp1)
    tmp90 = tmp87 + tmp89
    tmp91 = tmp17 - tmp85
    tmp92 = triton_helpers.maximum(tmp91, tmp1)
    tmp93 = tmp90 + tmp92
    tmp94 = tmp19 - tmp85
    tmp95 = triton_helpers.maximum(tmp94, tmp1)
    tmp96 = tmp93 + tmp95
    tmp97 = tmp96 - tmp12
    tmp98 = tmp97 * tmp33
    tmp99 = tmp98 >= tmp1
    tmp100 = tl.where(tmp99, tmp85, tmp83)
    tmp101 = tmp84 * tmp38
    tmp102 = tmp100 + tmp101
    tmp103 = tmp14 - tmp102
    tmp104 = triton_helpers.maximum(tmp103, tmp1)
    tmp105 = tmp15 - tmp102
    tmp106 = triton_helpers.maximum(tmp105, tmp1)
    tmp107 = tmp104 + tmp106
    tmp108 = tmp17 - tmp102
    tmp109 = triton_helpers.maximum(tmp108, tmp1)
    tmp110 = tmp107 + tmp109
    tmp111 = tmp19 - tmp102
    tmp112 = triton_helpers.maximum(tmp111, tmp1)
    tmp113 = tmp110 + tmp112
    tmp114 = tmp113 - tmp12
    tmp115 = tmp114 * tmp33
    tmp116 = tmp115 >= tmp1
    tmp117 = tl.where(tmp116, tmp102, tmp100)
    tmp118 = tmp101 * tmp38
    tmp119 = tmp117 + tmp118
    tmp120 = tmp14 - tmp119
    tmp121 = triton_helpers.maximum(tmp120, tmp1)
    tmp122 = tmp15 - tmp119
    tmp123 = triton_helpers.maximum(tmp122, tmp1)
    tmp124 = tmp121 + tmp123
    tmp125 = tmp17 - tmp119
    tmp126 = triton_helpers.maximum(tmp125, tmp1)
    tmp127 = tmp124 + tmp126
    tmp128 = tmp19 - tmp119
    tmp129 = triton_helpers.maximum(tmp128, tmp1)
    tmp130 = tmp127 + tmp129
    tmp131 = tmp130 - tmp12
    tmp132 = tmp131 * tmp33
    tmp133 = tmp132 >= tmp1
    tmp134 = tl.where(tmp133, tmp119, tmp117)
    tmp135 = tmp118 * tmp38
    tmp136 = tmp134 + tmp135
    tmp137 = tmp14 - tmp136
    tmp138 = triton_helpers.maximum(tmp137, tmp1)
    tmp139 = tmp15 - tmp136
    tmp140 = triton_helpers.maximum(tmp139, tmp1)
    tmp141 = tmp138 + tmp140
    tmp142 = tmp17 - tmp136
    tmp143 = triton_helpers.maximum(tmp142, tmp1)
    tmp144 = tmp141 + tmp143
    tmp145 = tmp19 - tmp136
    tmp146 = triton_helpers.maximum(tmp145, tmp1)
    tmp147 = tmp144 + tmp146
    tmp148 = tmp147 - tmp12
    tmp149 = tmp148 * tmp33
    tmp150 = tmp149 >= tmp1
    tmp151 = tl.where(tmp150, tmp136, tmp134)
    tmp152 = tmp135 * tmp38
    tmp153 = tmp151 + tmp152
    tmp154 = tmp14 - tmp153
    tmp155 = triton_helpers.maximum(tmp154, tmp1)
    tmp156 = tmp15 - tmp153
    tmp157 = triton_helpers.maximum(tmp156, tmp1)
    tmp158 = tmp155 + tmp157
    tmp159 = tmp17 - tmp153
    tmp160 = triton_helpers.maximum(tmp159, tmp1)
    tmp161 = tmp158 + tmp160
    tmp162 = tmp19 - tmp153
    tmp163 = triton_helpers.maximum(tmp162, tmp1)
    tmp164 = tmp161 + tmp163
    tl.store(out_ptr4 + x0, tmp101, xmask)
    tl.store(in_out_ptr2 + x0, tmp151, xmask)
    tl.store(out_ptr7 + x0, tmp164, xmask)


@triton.jit
def triton_poi_fused_add_clamp_div_sub_10(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + x1, xmask, eviction_policy='evict_last')
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tmp4 * tmp3
    tmp6 = tmp5 * tmp3
    tmp7 = tmp1 + tmp6
    tmp8 = tmp0 - tmp7
    tmp9 = 0.0
    tmp10 = triton_helpers.maximum(tmp8, tmp9)
    tmp12 = tmp10 / tmp11
    tl.store(out_ptr0 + x2, tmp12, xmask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf40 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf41 = reinterpret_tensor(buf40, (4, 4, 4, 1), (16, 4, 1, 64), 0)
        del buf40
        get_raw_stream(0)
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_0[grid(64)](buf41,
            arg0_1, 64, XBLOCK=64, num_warps=1, num_stages=1)
        buf42 = empty_strided_cuda((4, 4, 4, 1), (16, 4, 1, 64), torch.float32)
        buf81 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf82 = reinterpret_tensor(buf81, (4, 4, 4, 1), (16, 4, 1, 64), 0)
        del buf81
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_1[grid(64)](buf82,
            arg0_1, buf41, buf42, 64, XBLOCK=64, num_warps=1, num_stages=1)
        buf83 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_add_clamp_div_sub_2[grid(256)](arg0_1, buf82,
            buf42, buf83, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf85 = buf82
        del buf82
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_3[grid(64)](buf85,
            buf83, arg0_1, buf42, 64, XBLOCK=64, num_warps=1, num_stages=1)
        buf86 = buf83
        del buf83
        triton_poi_fused_add_clamp_div_sub_4[grid(256)](arg0_1, buf85,
            buf42, buf86, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf88 = buf85
        del buf85
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_5[grid(64)](buf88,
            buf86, arg0_1, buf42, 64, XBLOCK=64, num_warps=1, num_stages=1)
        buf89 = buf86
        del buf86
        triton_poi_fused_add_div_sub_6[grid(256)](arg0_1, buf88, buf42,
            buf89, 256, XBLOCK=256, num_warps=4, num_stages=1)
        buf91 = buf88
        del buf88
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_7[grid(64)](buf91,
            buf89, arg0_1, buf42, 64, XBLOCK=64, num_warps=1, num_stages=1)
        buf92 = buf89
        del buf89
        triton_poi_fused_add_div_sub_8[grid(256)](arg0_1, buf91, buf42,
            buf92, 256, XBLOCK=256, num_warps=4, num_stages=1)
        buf94 = buf91
        del buf91
        buf100 = buf41
        del buf41
        buf103 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf104 = reinterpret_tensor(buf103, (4, 4, 4, 1), (16, 4, 1, 64), 0)
        del buf103
        buf105 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_add_clamp_div_max_mul_sub_sum_where_9[grid(64)](buf94,
            buf104, buf92, arg0_1, buf42, buf100, buf105, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        del buf42
        del buf94
        buf106 = buf92
        del buf92
        triton_poi_fused_add_clamp_div_sub_10[grid(256)](arg0_1, buf104,
            buf100, buf105, buf106, 256, XBLOCK=256, num_warps=4, num_stages=1)
        del arg0_1
        del buf100
        del buf104
        del buf105
    return buf106,


def sparsemax_bisect(X, dim=-1, n_iter=50, ensure_sum_one=True):
    """sparsemax: normalizing sparse transform (a la softmax), via bisection.

    Solves the projection:

        min_p ||x - p||_2   s.t.    p >= 0, sum(p) == 1.

    Parameters
    ----------
    X : torch.Tensor
        The input tensor.

    dim : int
        The dimension along which to apply sparsemax.

    n_iter : int
        Number of bisection iterations. For float32, 24 iterations should
        suffice for machine precision.

    ensure_sum_one : bool,
        Whether to divide the result by its sum. If false, the result might
        sum to close but not exactly 1, which might cause downstream problems.

    Note: This function does not yet support normalizing along anything except
    the last dimension. Please use transposing and views to achieve more
    general behavior.

    Returns
    -------
    P : torch tensor, same shape as X
        The projection result, such that P.sum(dim=dim) == 1 elementwise.
    """
    return SparsemaxBisectFunction.apply(X, dim, n_iter, ensure_sum_one)


class EntmaxBisectFunction(Function):

    @classmethod
    def _gp(cls, x, alpha):
        return x ** (alpha - 1)

    @classmethod
    def _gp_inv(cls, y, alpha):
        return y ** (1 / (alpha - 1))

    @classmethod
    def _p(cls, X, alpha):
        return cls._gp_inv(torch.clamp(X, min=0), alpha)

    @classmethod
    def forward(cls, ctx, X, alpha=1.5, dim=-1, n_iter=50, ensure_sum_one=True
        ):
        if not isinstance(alpha, torch.Tensor):
            alpha = torch.tensor(alpha, dtype=X.dtype, device=X.device)
        alpha_shape = list(X.shape)
        alpha_shape[dim] = 1
        alpha = alpha.expand(*alpha_shape)
        ctx.alpha = alpha
        ctx.dim = dim
        d = X.shape[dim]
        X = X * (alpha - 1)
        max_val, _ = X.max(dim=dim, keepdim=True)
        tau_lo = max_val - cls._gp(1, alpha)
        tau_hi = max_val - cls._gp(1 / d, alpha)
        f_lo = cls._p(X - tau_lo, alpha).sum(dim) - 1
        dm = tau_hi - tau_lo
        for it in range(n_iter):
            dm /= 2
            tau_m = tau_lo + dm
            p_m = cls._p(X - tau_m, alpha)
            f_m = p_m.sum(dim) - 1
            mask = (f_m * f_lo >= 0).unsqueeze(dim)
            tau_lo = torch.where(mask, tau_m, tau_lo)
        if ensure_sum_one:
            p_m /= p_m.sum(dim=dim).unsqueeze(dim=dim)
        ctx.save_for_backward(p_m)
        return p_m

    @classmethod
    def backward(cls, ctx, dY):
        Y, = ctx.saved_tensors
        gppr = torch.where(Y > 0, Y ** (2 - ctx.alpha), Y.new_zeros(1))
        dX = dY * gppr
        q = dX.sum(ctx.dim) / gppr.sum(ctx.dim)
        q = q.unsqueeze(ctx.dim)
        dX -= q * gppr
        d_alpha = None
        if ctx.needs_input_grad[1]:
            S = torch.where(Y > 0, Y * torch.log(Y), Y.new_zeros(1))
            ent = S.sum(ctx.dim).unsqueeze(ctx.dim)
            Y_skewed = gppr / gppr.sum(ctx.dim).unsqueeze(ctx.dim)
            d_alpha = dY * (Y - Y_skewed) / (ctx.alpha - 1) ** 2
            d_alpha -= dY * (S - Y_skewed * ent) / (ctx.alpha - 1)
            d_alpha = d_alpha.sum(ctx.dim).unsqueeze(ctx.dim)
        return dX, d_alpha, None, None, None


class SparsemaxBisectFunction(EntmaxBisectFunction):

    @classmethod
    def _gp(cls, x, alpha):
        return x

    @classmethod
    def _gp_inv(cls, y, alpha):
        return y

    @classmethod
    def _p(cls, x, alpha):
        return torch.clamp(x, min=0)

    @classmethod
    def forward(cls, ctx, X, dim=-1, n_iter=50, ensure_sum_one=True):
        return super().forward(ctx, X, alpha=2, dim=dim, n_iter=50,
            ensure_sum_one=True)

    @classmethod
    def backward(cls, ctx, dY):
        Y, = ctx.saved_tensors
        gppr = Y > 0
        dX = dY * gppr
        q = dX.sum(ctx.dim) / gppr.sum(ctx.dim)
        q = q.unsqueeze(ctx.dim)
        dX -= q * gppr
        return dX, None, None, None


class SparsemaxBisectNew(nn.Module):

    def __init__(self, dim=-1, n_iter=None):
        """sparsemax: normalizing sparse transform (a la softmax) via bisection

        Solves the projection:

            min_p ||x - p||_2   s.t.    p >= 0, sum(p) == 1.

        Parameters
        ----------
        dim : int
            The dimension along which to apply sparsemax.

        n_iter : int
            Number of bisection iterations. For float32, 24 iterations should
            suffice for machine precision.
        """
        self.dim = dim
        self.n_iter = n_iter
        super().__init__()

    def forward(self, input_0):
        arg0_1 = input_0
        output = call([arg0_1])
        return output[0]
