import torch
from torch._inductor.select_algorithm import extern_kernels
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._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn.functional as F
import torch.autograd
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_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 128
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 8
    x1 = xindex // 8
    x2 = xindex
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (4 * (x1 // 4) + x0), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp6 = tmp0 >= tmp3
    tl.full([1], 8, tl.int64)
    tmp9 = tl.load(in_ptr0 + (4 * (x1 % 4) + (-4 + x0)), tmp6 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp10 = tl.where(tmp4, tmp5, tmp9)
    tl.store(out_ptr0 + x2, tmp10, xmask)


@triton.jit
def triton_poi_fused_leaky_relu_1(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tl.store(out_ptr0 + x0, tmp2, xmask)


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


@triton.jit
def triton_poi_fused__softmax_gt_leaky_relu_mul_where_3(in_out_ptr0,
    in_out_ptr1, in_out_ptr2, in_out_ptr3, in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, in_ptr9, in_ptr10,
    in_ptr11, in_ptr12, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    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)
    tmp3 = tl.load(in_ptr1 + x2, xmask).to(tl.int1)
    tmp4 = tl.load(in_out_ptr0 + x2, xmask)
    tmp11 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr3 + x1, xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr4 + x2, xmask).to(tl.int1)
    tmp17 = tl.load(in_out_ptr1 + x2, xmask)
    tmp22 = tl.load(in_ptr5 + x1, xmask, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr6 + x1, xmask, eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr7 + x2, xmask).to(tl.int1)
    tmp28 = tl.load(in_out_ptr2 + x2, xmask)
    tmp33 = tl.load(in_ptr8 + x1, xmask, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr9 + x1, xmask, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr10 + x2, xmask).to(tl.int1)
    tmp39 = tl.load(in_out_ptr3 + x2, xmask)
    tmp44 = tl.load(in_ptr11 + x1, xmask, eviction_policy='evict_last')
    tmp47 = tl.load(in_ptr12 + x1, xmask, eviction_policy='evict_last')
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp3, tmp4, tmp6)
    tmp8 = tmp7 * tmp0
    tmp9 = -8999999815811072.0
    tmp10 = tl.where(tmp2, tmp8, tmp9)
    tmp12 = tmp10 - tmp11
    tmp13 = tl_math.exp(tmp12)
    tmp15 = tmp13 / tmp14
    tmp18 = tmp17 * tmp5
    tmp19 = tl.where(tmp16, tmp17, tmp18)
    tmp20 = tmp19 * tmp0
    tmp21 = tl.where(tmp2, tmp20, tmp9)
    tmp23 = tmp21 - tmp22
    tmp24 = tl_math.exp(tmp23)
    tmp26 = tmp24 / tmp25
    tmp29 = tmp28 * tmp5
    tmp30 = tl.where(tmp27, tmp28, tmp29)
    tmp31 = tmp30 * tmp0
    tmp32 = tl.where(tmp2, tmp31, tmp9)
    tmp34 = tmp32 - tmp33
    tmp35 = tl_math.exp(tmp34)
    tmp37 = tmp35 / tmp36
    tmp40 = tmp39 * tmp5
    tmp41 = tl.where(tmp38, tmp39, tmp40)
    tmp42 = tmp41 * tmp0
    tmp43 = tl.where(tmp2, tmp42, tmp9)
    tmp45 = tmp43 - tmp44
    tmp46 = tl_math.exp(tmp45)
    tmp48 = tmp46 / tmp47
    tl.store(in_out_ptr0 + x2, tmp15, xmask)
    tl.store(in_out_ptr1 + x2, tmp26, xmask)
    tl.store(in_out_ptr2 + x2, tmp37, xmask)
    tl.store(in_out_ptr3 + x2, tmp48, xmask)


@triton.jit
def triton_poi_fused_cat_4(in_ptr0, in_ptr1, in_ptr2, in_ptr3, 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 % 16
    x1 = xindex // 16
    x2 = xindex
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (4 * x1 + x0), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = 0.0
    tmp7 = tmp5 > tmp6
    tmp8 = 1.0
    tmp9 = tmp5 * tmp8
    tmp10 = libdevice.expm1(tmp9)
    tmp11 = tmp10 * tmp8
    tmp12 = tl.where(tmp7, tmp9, tmp11)
    tmp13 = tl.full(tmp12.shape, 0.0, tmp12.dtype)
    tmp14 = tl.where(tmp4, tmp12, tmp13)
    tmp15 = tmp0 >= tmp3
    tmp16 = tl.full([1], 8, tl.int64)
    tmp17 = tmp0 < tmp16
    tmp18 = tmp15 & tmp17
    tmp19 = tl.load(in_ptr1 + (4 * x1 + (-4 + x0)), tmp18 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp20 = tmp19 > tmp6
    tmp21 = tmp19 * tmp8
    tmp22 = libdevice.expm1(tmp21)
    tmp23 = tmp22 * tmp8
    tmp24 = tl.where(tmp20, tmp21, tmp23)
    tmp25 = tl.full(tmp24.shape, 0.0, tmp24.dtype)
    tmp26 = tl.where(tmp18, tmp24, tmp25)
    tmp27 = tmp0 >= tmp16
    tmp28 = tl.full([1], 12, tl.int64)
    tmp29 = tmp0 < tmp28
    tmp30 = tmp27 & tmp29
    tmp31 = tl.load(in_ptr2 + (4 * x1 + (-8 + x0)), tmp30 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp32 = tmp31 > tmp6
    tmp33 = tmp31 * tmp8
    tmp34 = libdevice.expm1(tmp33)
    tmp35 = tmp34 * tmp8
    tmp36 = tl.where(tmp32, tmp33, tmp35)
    tmp37 = tl.full(tmp36.shape, 0.0, tmp36.dtype)
    tmp38 = tl.where(tmp30, tmp36, tmp37)
    tmp39 = tmp0 >= tmp28
    tl.full([1], 16, tl.int64)
    tmp42 = tl.load(in_ptr3 + (4 * x1 + (-12 + x0)), tmp39 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp43 = tmp42 > tmp6
    tmp44 = tmp42 * tmp8
    tmp45 = libdevice.expm1(tmp44)
    tmp46 = tmp45 * tmp8
    tmp47 = tl.where(tmp43, tmp44, tmp46)
    tmp48 = tl.full(tmp47.shape, 0.0, tmp47.dtype)
    tmp49 = tl.where(tmp39, tmp47, tmp48)
    tmp50 = tl.where(tmp30, tmp38, tmp49)
    tmp51 = tl.where(tmp18, tmp26, tmp50)
    tmp52 = tl.where(tmp4, tmp14, tmp51)
    tl.store(out_ptr0 + x2, tmp52, xmask)


@triton.jit
def triton_poi_fused__softmax_gt_leaky_relu_mul_where_5(in_ptr0, in_ptr1,
    in_ptr2, out_ptr0, out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 4
    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_ptr1 + 4 * x0, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp4 = tl.load(in_ptr2 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp13 = tl.load(in_ptr1 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp14 = tl.load(in_ptr2 + (1 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp20 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp22 = tl.load(in_ptr1 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp23 = tl.load(in_ptr2 + (2 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp29 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp31 = tl.load(in_ptr1 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        ).to(tl.int1)
    tmp32 = tl.load(in_ptr2 + (3 + 4 * x0), xmask, eviction_policy='evict_last'
        )
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp3, tmp4, tmp6)
    tmp8 = tmp7 * tmp0
    tmp9 = -8999999815811072.0
    tmp10 = tl.where(tmp2, tmp8, tmp9)
    tmp12 = tmp11 > tmp1
    tmp15 = tmp14 * tmp5
    tmp16 = tl.where(tmp13, tmp14, tmp15)
    tmp17 = tmp16 * tmp11
    tmp18 = tl.where(tmp12, tmp17, tmp9)
    tmp19 = triton_helpers.maximum(tmp10, tmp18)
    tmp21 = tmp20 > tmp1
    tmp24 = tmp23 * tmp5
    tmp25 = tl.where(tmp22, tmp23, tmp24)
    tmp26 = tmp25 * tmp20
    tmp27 = tl.where(tmp21, tmp26, tmp9)
    tmp28 = triton_helpers.maximum(tmp19, tmp27)
    tmp30 = tmp29 > tmp1
    tmp33 = tmp32 * tmp5
    tmp34 = tl.where(tmp31, tmp32, tmp33)
    tmp35 = tmp34 * tmp29
    tmp36 = tl.where(tmp30, tmp35, tmp9)
    tmp37 = triton_helpers.maximum(tmp28, tmp36)
    tmp38 = tmp10 - tmp37
    tmp39 = tl_math.exp(tmp38)
    tmp40 = tmp18 - tmp37
    tmp41 = tl_math.exp(tmp40)
    tmp42 = tmp39 + tmp41
    tmp43 = tmp27 - tmp37
    tmp44 = tl_math.exp(tmp43)
    tmp45 = tmp42 + tmp44
    tmp46 = tmp36 - tmp37
    tmp47 = tl_math.exp(tmp46)
    tmp48 = tmp45 + tmp47
    tl.store(out_ptr0 + x0, tmp37, xmask)
    tl.store(out_ptr1 + x0, tmp48, xmask)


@triton.jit
def triton_poi_fused__softmax_gt_leaky_relu_mul_where_6(in_out_ptr0,
    in_ptr0, in_ptr1, in_ptr2, in_ptr3, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    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)
    tmp3 = tl.load(in_ptr1 + x2, xmask).to(tl.int1)
    tmp4 = tl.load(in_out_ptr0 + x2, xmask)
    tmp11 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr3 + x1, xmask, eviction_policy='evict_last')
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp5 = 4.0
    tmp6 = tmp4 * tmp5
    tmp7 = tl.where(tmp3, tmp4, tmp6)
    tmp8 = tmp7 * tmp0
    tmp9 = -8999999815811072.0
    tmp10 = tl.where(tmp2, tmp8, tmp9)
    tmp12 = tmp10 - tmp11
    tmp13 = tl_math.exp(tmp12)
    tmp15 = tmp13 / tmp14
    tl.store(in_out_ptr0 + x2, tmp15, xmask)


@triton.jit
def triton_poi_fused_elu_7(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 1.0
    tmp4 = tmp0 * tmp3
    tmp5 = libdevice.expm1(tmp4)
    tmp6 = tmp5 * tmp3
    tmp7 = tl.where(tmp2, tmp4, tmp6)
    tl.store(out_ptr0 + x0, tmp7, xmask)


@triton.jit
def triton_poi_fused__log_softmax_8(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 16
    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_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp3 = triton_helpers.maximum(tmp1, tmp2)
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp0 - tmp7
    tl.store(out_ptr0 + x2, tmp8, xmask)


@triton.jit
def triton_poi_fused__log_softmax_9(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 16
    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_ptr0 + 4 * x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + 4 * x1), xmask, eviction_policy='evict_last')
    tmp2 = tl_math.exp(tmp1)
    tmp4 = tl_math.exp(tmp3)
    tmp5 = tmp2 + tmp4
    tmp7 = tl_math.exp(tmp6)
    tmp8 = tmp5 + tmp7
    tmp10 = tl_math.exp(tmp9)
    tmp11 = tmp8 + tmp10
    tmp12 = tl_math.log(tmp11)
    tmp13 = tmp0 - tmp12
    tl.store(out_ptr0 + x2, tmp13, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12
        ) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4), (4, 1))
    assert_size_stride(primals_2, (4, 4), (4, 1))
    assert_size_stride(primals_3, (8, 1), (1, 1))
    assert_size_stride(primals_4, (4, 4), (4, 1))
    assert_size_stride(primals_5, (4, 4), (4, 1))
    assert_size_stride(primals_6, (8, 1), (1, 1))
    assert_size_stride(primals_7, (4, 4), (4, 1))
    assert_size_stride(primals_8, (8, 1), (1, 1))
    assert_size_stride(primals_9, (4, 4), (4, 1))
    assert_size_stride(primals_10, (8, 1), (1, 1))
    assert_size_stride(primals_11, (16, 4), (4, 1))
    assert_size_stride(primals_12, (8, 1), (1, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_2, out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(128)](buf0, buf1, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf1, primals_3, out=buf2)
        buf3 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf2, buf3, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf8 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_5, out=buf8)
        del primals_5
        buf9 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf8, buf9, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf10 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf9, primals_6, out=buf10)
        buf11 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf10, buf11, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf16 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_7, out=buf16)
        del primals_7
        buf17 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf16, buf17, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf18 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf17, primals_8, out=buf18)
        buf19 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf18, buf19, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf24 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(primals_1, primals_9, out=buf24)
        del primals_9
        buf25 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf24, buf25, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf26 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf25, primals_10, out=buf26)
        buf27 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf26, buf27, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf5 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf12 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf13 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf20 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf21 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf28 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf29 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        triton_poi_fused__softmax_gt_leaky_relu_mul_where_2[grid(4)](primals_4,
            buf3, buf2, buf11, buf10, buf19, buf18, buf27, buf26, buf4,
            buf5, buf12, buf13, buf20, buf21, buf28, buf29, 4, XBLOCK=4,
            num_warps=1, num_stages=1)
        buf6 = reinterpret_tensor(buf2, (4, 4), (4, 1), 0)
        del buf2
        buf14 = reinterpret_tensor(buf10, (4, 4), (4, 1), 0)
        del buf10
        buf22 = reinterpret_tensor(buf18, (4, 4), (4, 1), 0)
        del buf18
        buf30 = reinterpret_tensor(buf26, (4, 4), (4, 1), 0)
        del buf26
        triton_poi_fused__softmax_gt_leaky_relu_mul_where_3[grid(16)](buf6,
            buf14, buf22, buf30, primals_4, buf3, buf4, buf5, buf11, buf12,
            buf13, buf19, buf20, buf21, buf27, buf28, buf29, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        del buf12
        del buf13
        del buf20
        del buf21
        del buf28
        del buf29
        buf7 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf6, buf0, out=buf7)
        buf15 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf14, buf8, out=buf15)
        buf23 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf22, buf16, out=buf23)
        buf31 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf30, buf24, out=buf31)
        buf32 = empty_strided_cuda((4, 16), (16, 1), torch.float32)
        triton_poi_fused_cat_4[grid(64)](buf7, buf15, buf23, buf31, buf32, 
            64, XBLOCK=64, num_warps=1, num_stages=1)
        buf33 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf32, primals_11, out=buf33)
        buf34 = empty_strided_cuda((16, 8), (8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(128)](buf33, buf34, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf35 = empty_strided_cuda((16, 1), (1, 1), torch.float32)
        extern_kernels.mm(buf34, primals_12, out=buf35)
        buf36 = empty_strided_cuda((4, 4), (4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(16)](buf35, buf36, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf37 = buf5
        del buf5
        buf38 = buf4
        del buf4
        triton_poi_fused__softmax_gt_leaky_relu_mul_where_5[grid(4)](primals_4,
            buf36, buf35, buf37, buf38, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf39 = reinterpret_tensor(buf35, (4, 4), (4, 1), 0)
        del buf35
        triton_poi_fused__softmax_gt_leaky_relu_mul_where_6[grid(16)](buf39,
            primals_4, buf36, buf37, buf38, 16, XBLOCK=16, num_warps=1,
            num_stages=1)
        del buf37
        del buf38
        buf40 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        extern_kernels.mm(buf39, buf33, out=buf40)
        buf41 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused_elu_7[grid(16)](buf40, buf41, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf42 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused__log_softmax_8[grid(16)](buf41, buf42, 16, XBLOCK=
            16, num_warps=1, num_stages=1)
        buf43 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused__log_softmax_9[grid(16)](buf42, buf43, 16, XBLOCK=
            16, num_warps=1, num_stages=1)
        del buf42
    return (buf43, buf41, primals_4, buf3, buf6, buf7, buf11, buf14, buf15,
        buf19, buf22, buf23, buf27, buf30, buf31, buf36, buf39, buf40,
        buf43, reinterpret_tensor(buf33, (4, 4), (1, 4), 0),
        reinterpret_tensor(buf34, (8, 16), (1, 8), 0), reinterpret_tensor(
        primals_12, (1, 8), (1, 1), 0), reinterpret_tensor(buf32, (16, 4),
        (1, 16), 0), reinterpret_tensor(primals_11, (4, 16), (1, 4), 0),
        reinterpret_tensor(buf24, (4, 4), (1, 4), 0), reinterpret_tensor(
        buf25, (8, 16), (1, 8), 0), reinterpret_tensor(primals_10, (1, 8),
        (1, 1), 0), reinterpret_tensor(primals_1, (4, 4), (1, 4), 0),
        reinterpret_tensor(buf16, (4, 4), (1, 4), 0), reinterpret_tensor(
        buf17, (8, 16), (1, 8), 0), reinterpret_tensor(primals_8, (1, 8), (
        1, 1), 0), reinterpret_tensor(buf8, (4, 4), (1, 4), 0),
        reinterpret_tensor(buf9, (8, 16), (1, 8), 0), reinterpret_tensor(
        primals_6, (1, 8), (1, 1), 0), reinterpret_tensor(buf0, (4, 4), (1,
        4), 0), reinterpret_tensor(buf1, (8, 16), (1, 8), 0),
        reinterpret_tensor(primals_3, (1, 8), (1, 1), 0))


class GraphAttConv(nn.Module):

    def __init__(self, in_features, out_features, dropout, alpha, concat=True):
        super(GraphAttConv, self).__init__()
        self.dropout = dropout
        self.in_features = in_features
        self.out_features = out_features
        self.alpha = alpha
        self.concat = concat
        self.W = nn.Parameter(torch.empty(size=(in_features, out_features)))
        nn.init.xavier_uniform_(self.W.data, gain=1.414)
        self.attention_w = nn.Parameter(torch.empty(size=(2 * out_features, 1))
            )
        nn.init.xavier_uniform_(self.attention_w.data, gain=1.414)
        self.leakyrelu = nn.LeakyReLU(self.alpha)

    def forward(self, h, adj):
        hidden = torch.mm(h, self.W)
        attention_input = self._prepare_attentional_mechanism_input(hidden)
        e = self.leakyrelu(torch.matmul(attention_input, self.attention_w).
            squeeze(2))
        zero_vec = -9000000000000000.0 * torch.ones_like(e)
        attention = torch.where(adj > 0, e * adj, zero_vec)
        attention = F.softmax(attention, dim=1)
        attention = F.dropout(attention, self.dropout, training=self.training)
        h_prime = torch.matmul(attention, hidden)
        if self.concat:
            return F.elu(h_prime)
        else:
            return h_prime

    def _prepare_attentional_mechanism_input(self, Wh):
        N = Wh.size(0)
        Wh_repeated_in_chunks = Wh.repeat_interleave(N, dim=0)
        Wh_repeated_alternating = Wh.repeat(N, 1)
        all_combinations_matrix = torch.cat([Wh_repeated_in_chunks,
            Wh_repeated_alternating], dim=1)
        return all_combinations_matrix.view(N, N, 2 * self.out_features)


class GATNew(nn.Module):

    def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
        """Dense version of GAT."""
        super(GATNew, self).__init__()
        self.dropout = dropout
        self.attentions = [GraphAttConv(nfeat, nhid, dropout=dropout, alpha
            =alpha, concat=True) for _ in range(nheads)]
        for i, attention in enumerate(self.attentions):
            self.add_module('attention_{}'.format(i), attention)
        self.out_att = GraphAttConv(nhid * nheads, nclass, dropout=dropout,
            alpha=alpha, concat=False)

    def forward(self, input_0, input_1):
        primals_1 = self.attention_0.W
        primals_3 = self.attention_0.attention_w
        primals_2 = self.attention_1.W
        primals_6 = self.attention_1.attention_w
        primals_4 = self.attention_2.W
        primals_8 = self.attention_2.attention_w
        primals_5 = self.attention_3.W
        primals_10 = self.attention_3.attention_w
        primals_11 = self.out_att.W
        primals_12 = self.out_att.attention_w
        primals_7 = input_0
        primals_9 = input_1
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12])
        return output[0], output[1]


Measured latency_ms: 0.06668