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 as nn
import torch.nn.functional as F
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 = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 8
    x1 = xindex // 8 % 16
    x2 = xindex // 128
    x3 = 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 * ((4 * x1 + x0) // 16 % 4) + 16 * ((4 * x1 +
        64 * x2 + x0) // 64 % 4) + (4 * x1 + x0) % 16 % 4), 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) + 16 * x2 + (-4 + x0)), tmp6 &
        xmask, eviction_policy='evict_last', other=0.0)
    tmp10 = tl.where(tmp4, tmp5, tmp9)
    tl.store(out_ptr0 + x3, tmp10, xmask)


@triton.jit
def triton_poi_fused_leaky_relu_1(in_ptr0, 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 + x0, xmask)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tl.store(out_ptr0 + x0, tmp2, xmask)


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


@triton.jit
def triton_poi_fused__softmax_leaky_relu_mul_where_4(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, in_ptr13, in_ptr14, in_ptr15, in_ptr16,
    out_ptr0, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x4 = xindex % 64
    x0 = xindex % 16
    x2 = xindex // 64
    tmp0 = tl.load(in_ptr0 + x3, xmask).to(tl.int1)
    tmp1 = tl.load(in_ptr1 + x4, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp2 = tl.load(in_ptr2 + x4, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr3 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp11 = tl.load(in_ptr4 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp13 = tl.load(in_ptr5 + x4, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp14 = tl.load(in_ptr6 + x4, xmask, eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr7 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp21 = tl.load(in_ptr8 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr9 + x4, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp24 = tl.load(in_ptr10 + x4, xmask, eviction_policy='evict_last')
    tmp28 = tl.load(in_ptr11 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp31 = tl.load(in_ptr12 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp33 = tl.load(in_ptr13 + x4, xmask, eviction_policy='evict_last').to(tl
        .int1)
    tmp34 = tl.load(in_ptr14 + x4, xmask, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr15 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp41 = tl.load(in_ptr16 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp3 = 4.0
    tmp4 = tmp2 * tmp3
    tmp5 = tl.where(tmp1, tmp2, tmp4)
    tmp6 = -8999999815811072.0
    tmp7 = tl.where(tmp0, tmp5, tmp6)
    tmp9 = tmp7 - tmp8
    tmp10 = tl_math.exp(tmp9)
    tmp12 = tmp10 / tmp11
    tmp15 = tmp14 * tmp3
    tmp16 = tl.where(tmp13, tmp14, tmp15)
    tmp17 = tl.where(tmp0, tmp16, tmp6)
    tmp19 = tmp17 - tmp18
    tmp20 = tl_math.exp(tmp19)
    tmp22 = tmp20 / tmp21
    tmp25 = tmp24 * tmp3
    tmp26 = tl.where(tmp23, tmp24, tmp25)
    tmp27 = tl.where(tmp0, tmp26, tmp6)
    tmp29 = tmp27 - tmp28
    tmp30 = tl_math.exp(tmp29)
    tmp32 = tmp30 / tmp31
    tmp35 = tmp34 * tmp3
    tmp36 = tl.where(tmp33, tmp34, tmp35)
    tmp37 = tl.where(tmp0, tmp36, tmp6)
    tmp39 = tmp37 - tmp38
    tmp40 = tl_math.exp(tmp39)
    tmp42 = tmp40 / tmp41
    tl.store(out_ptr0 + x3, tmp12, xmask)
    tl.store(out_ptr1 + x3, tmp22, xmask)
    tl.store(out_ptr2 + x3, tmp32, xmask)
    tl.store(out_ptr3 + x3, tmp42, xmask)


@triton.jit
def triton_poi_fused_clone_5(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 64
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tl.store(out_ptr0 + x2, tmp0, xmask)


@triton.jit
def triton_poi_fused_cat_6(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 16 % 16
    x0 = xindex % 16
    x2 = xindex // 256
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 16 * x1 + 64 * x2), tmp4 & xmask, 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 + (x0 + 16 * (-4 + x1) + 64 * x2), tmp18 &
        xmask, 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 + (x0 + 16 * (-8 + x1) + 64 * x2), tmp30 &
        xmask, 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 + (x0 + 16 * (-12 + x1) + 64 * x2), tmp39 &
        xmask, 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 + x3, tmp52, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 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, 4), (64, 16, 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))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            primals_2, out=buf0)
        del primals_2
        buf1 = empty_strided_cuda((4, 16, 8), (128, 8, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(512)](buf0, buf1, 512, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(buf1, (64, 8), (8, 1), 0),
            primals_3, out=buf2)
        buf3 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(64)](buf2, buf3, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        triton_poi_fused_gt_2[grid(256)](primals_4, buf4, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        del primals_4
        buf10 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            primals_5, out=buf10)
        del primals_5
        buf11 = empty_strided_cuda((4, 16, 8), (128, 8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(512)](buf10, buf11, 512, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf12 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(buf11, (64, 8), (8, 1), 0),
            primals_6, out=buf12)
        buf13 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(64)](buf12, buf13, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf19 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            primals_7, out=buf19)
        del primals_7
        buf20 = empty_strided_cuda((4, 16, 8), (128, 8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(512)](buf19, buf20, 512, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf21 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(buf20, (64, 8), (8, 1), 0),
            primals_8, out=buf21)
        buf22 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(64)](buf21, buf22, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf28 = empty_strided_cuda((16, 4), (4, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(primals_1, (16, 4), (4, 1), 0),
            primals_9, out=buf28)
        del primals_9
        buf29 = empty_strided_cuda((4, 16, 8), (128, 8, 1), torch.float32)
        triton_poi_fused_cat_0[grid(512)](buf28, buf29, 512, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf30 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(buf29, (64, 8), (8, 1), 0),
            primals_10, out=buf30)
        buf31 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.bool)
        triton_poi_fused_leaky_relu_1[grid(64)](buf30, buf31, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf5 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf6 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf14 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf15 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf23 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf24 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf32 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf33 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        triton_poi_fused__softmax_leaky_relu_mul_where_3[grid(64)](buf4,
            buf3, buf2, buf13, buf12, buf22, buf21, buf31, buf30, buf5,
            buf6, buf14, buf15, buf23, buf24, buf32, buf33, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf7 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf16 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf25 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf34 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused__softmax_leaky_relu_mul_where_4[grid(256)](buf4,
            buf3, buf2, buf5, buf6, buf13, buf12, buf14, buf15, buf22,
            buf21, buf23, buf24, buf31, buf30, buf32, buf33, buf7, buf16,
            buf25, buf34, 256, XBLOCK=128, num_warps=4, num_stages=1)
        del buf12
        del buf14
        del buf15
        del buf2
        del buf21
        del buf23
        del buf24
        del buf30
        del buf32
        del buf33
        del buf5
        del buf6
        buf8 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_clone_5[grid(256)](buf0, buf8, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        del buf0
        buf9 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf7, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf8, (16, 4, 4), (16, 4, 1), 0), out=buf9)
        buf17 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_clone_5[grid(256)](buf10, buf17, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        del buf10
        buf18 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf16, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf17, (16, 4, 4), (16, 4, 1), 0), out=buf18
            )
        buf26 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_clone_5[grid(256)](buf19, buf26, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        del buf19
        buf27 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf25, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf26, (16, 4, 4), (16, 4, 1), 0), out=buf27
            )
        buf35 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_clone_5[grid(256)](buf28, buf35, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        del buf28
        buf36 = empty_strided_cuda((16, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf34, (16, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf35, (16, 4, 4), (16, 4, 1), 0), out=buf36
            )
        buf37 = empty_strided_cuda((4, 16, 4, 4), (256, 16, 4, 1), torch.
            float32)
        triton_poi_fused_cat_6[grid(1024)](buf9, buf18, buf27, buf36, buf37,
            1024, XBLOCK=128, num_warps=4, num_stages=1)
    return (buf37, buf3, buf4, buf7, buf9, buf13, buf16, buf18, buf22,
        buf25, buf27, buf31, buf34, buf36, reinterpret_tensor(buf35, (16, 4,
        4), (16, 1, 4), 0), reinterpret_tensor(buf29, (8, 64), (1, 8), 0),
        reinterpret_tensor(primals_10, (1, 8), (1, 1), 0),
        reinterpret_tensor(primals_1, (4, 16), (1, 4), 0),
        reinterpret_tensor(buf26, (16, 4, 4), (16, 1, 4), 0),
        reinterpret_tensor(buf20, (8, 64), (1, 8), 0), reinterpret_tensor(
        primals_8, (1, 8), (1, 1), 0), reinterpret_tensor(buf17, (16, 4, 4),
        (16, 1, 4), 0), reinterpret_tensor(buf11, (8, 64), (1, 8), 0),
        reinterpret_tensor(primals_6, (1, 8), (1, 1), 0),
        reinterpret_tensor(buf8, (16, 4, 4), (16, 1, 4), 0),
        reinterpret_tensor(buf1, (8, 64), (1, 8), 0), reinterpret_tensor(
        primals_3, (1, 8), (1, 1), 0))


class GraphAttentionLayer(nn.Module):
    """
    Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
    """

    def __init__(self, in_features, out_features, dropout, alpha, concat=True):
        super(GraphAttentionLayer, 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.zeros(size=(in_features, out_features)))
        nn.init.xavier_uniform_(self.W.data, gain=1.414)
        self.a = nn.Parameter(torch.zeros(size=(2 * out_features, 1)))
        nn.init.xavier_uniform_(self.a.data, gain=1.414)
        self.leakyrelu = nn.LeakyReLU(self.alpha)

    def forward(self, input, adj):
        h = torch.matmul(input, self.W)
        N = h.size()[1]
        batch_size = h.size(0)
        a_input = torch.cat([h.repeat(1, 1, N).view(batch_size, N * N, -1),
            h.repeat(1, N, 1)], dim=2).view(batch_size, N, -1, 2 * self.
            out_features)
        e = self.leakyrelu(torch.matmul(a_input, self.a).squeeze(3))
        zero_vec = -9000000000000000.0 * torch.ones_like(e)
        attention = torch.where(adj > 0, e, zero_vec)
        attention = F.softmax(attention, dim=1)
        attention = F.dropout(attention, self.dropout, training=self.training)
        h_prime = torch.matmul(attention, h)
        if self.concat:
            return F.elu(h_prime)
        else:
            return h_prime

    def __repr__(self):
        return self.__class__.__name__ + ' (' + str(self.in_features
            ) + ' -> ' + str(self.out_features) + ')'


class GATNew(nn.Module):

    def __init__(self, nfeat, nhid, dropout, alpha, nheads):
        super(GATNew, self).__init__()
        self.dropout = dropout
        self.attentions = [GraphAttentionLayer(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)

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


Measured latency_ms: 0.041908