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
import numpy as np
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 = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4 % 4
    x0 = xindex % 4
    x2 = xindex // 16
    x3 = xindex % 16
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 16 * x2), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp7 = tmp5 + tmp6
    tmp8 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp9 = tmp7 + tmp8
    tmp10 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp11 = tmp9 + tmp10
    tmp12 = 0.25
    tmp13 = tmp11 * tmp12
    tmp14 = tl.full(tmp13.shape, 0.0, tmp13.dtype)
    tmp15 = tl.where(tmp4, tmp13, tmp14)
    tmp16 = tmp0 >= tmp3
    tmp17 = tl.full([1], 2, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr0 + (x0 + 16 * x2), tmp19 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp21 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), tmp19 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp22 = tmp20 + tmp21
    tmp23 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), tmp19 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp24 = tmp22 + tmp23
    tmp25 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), tmp19 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp26 = tmp24 + tmp25
    tmp27 = tmp26 * tmp12
    tmp28 = tl.full(tmp27.shape, 0.0, tmp27.dtype)
    tmp29 = tl.where(tmp19, tmp27, tmp28)
    tmp30 = tmp0 >= tmp17
    tmp31 = tl.full([1], 3, tl.int64)
    tmp32 = tmp0 < tmp31
    tmp33 = tmp30 & tmp32
    tmp34 = tl.load(in_ptr0 + (x0 + 16 * x2), tmp33 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp35 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), tmp33 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp36 = tmp34 + tmp35
    tmp37 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), tmp33 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp38 = tmp36 + tmp37
    tmp39 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), tmp33 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp40 = tmp38 + tmp39
    tmp41 = tmp40 * tmp12
    tmp42 = tl.full(tmp41.shape, 0.0, tmp41.dtype)
    tmp43 = tl.where(tmp33, tmp41, tmp42)
    tmp44 = tmp0 >= tmp31
    tl.full([1], 4, tl.int64)
    tmp47 = tl.load(in_ptr0 + (x0 + 16 * x2), tmp44 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp48 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), tmp44 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp49 = tmp47 + tmp48
    tmp50 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), tmp44 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp51 = tmp49 + tmp50
    tmp52 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), tmp44 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp53 = tmp51 + tmp52
    tmp54 = tmp53 * tmp12
    tmp55 = tl.full(tmp54.shape, 0.0, tmp54.dtype)
    tmp56 = tl.where(tmp44, tmp54, tmp55)
    tmp57 = tl.where(tmp33, tmp43, tmp56)
    tmp58 = tl.where(tmp19, tmp29, tmp57)
    tmp59 = tl.where(tmp4, tmp15, tmp58)
    tl.store(out_ptr0 + (x3 + 64 * x2), tmp59, xmask)


@triton.jit
def triton_poi_fused_cat_1(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 % 4
    x3 = xindex // 4
    x2 = xindex // 16
    x4 = xindex % 16
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + 4 * x3, tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = tl.load(in_ptr0 + (1 + 4 * x3), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp7 = tmp5 + tmp6
    tmp8 = tl.load(in_ptr0 + (2 + 4 * x3), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp9 = tmp7 + tmp8
    tmp10 = tl.load(in_ptr0 + (3 + 4 * x3), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp11 = tmp9 + tmp10
    tmp12 = 0.25
    tmp13 = tmp11 * tmp12
    tmp14 = tl.full(tmp13.shape, 0.0, tmp13.dtype)
    tmp15 = tl.where(tmp4, tmp13, tmp14)
    tmp16 = tmp0 >= tmp3
    tmp17 = tl.full([1], 2, tl.int64)
    tmp18 = tmp0 < tmp17
    tmp19 = tmp16 & tmp18
    tmp20 = tl.load(in_ptr0 + 4 * x3, tmp19 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp21 = tl.load(in_ptr0 + (1 + 4 * x3), tmp19 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp22 = tmp20 + tmp21
    tmp23 = tl.load(in_ptr0 + (2 + 4 * x3), tmp19 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp24 = tmp22 + tmp23
    tmp25 = tl.load(in_ptr0 + (3 + 4 * x3), tmp19 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp26 = tmp24 + tmp25
    tmp27 = tmp26 * tmp12
    tmp28 = tl.full(tmp27.shape, 0.0, tmp27.dtype)
    tmp29 = tl.where(tmp19, tmp27, tmp28)
    tmp30 = tmp0 >= tmp17
    tmp31 = tl.full([1], 3, tl.int64)
    tmp32 = tmp0 < tmp31
    tmp33 = tmp30 & tmp32
    tmp34 = tl.load(in_ptr0 + 4 * x3, tmp33 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp35 = tl.load(in_ptr0 + (1 + 4 * x3), tmp33 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp36 = tmp34 + tmp35
    tmp37 = tl.load(in_ptr0 + (2 + 4 * x3), tmp33 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp38 = tmp36 + tmp37
    tmp39 = tl.load(in_ptr0 + (3 + 4 * x3), tmp33 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp40 = tmp38 + tmp39
    tmp41 = tmp40 * tmp12
    tmp42 = tl.full(tmp41.shape, 0.0, tmp41.dtype)
    tmp43 = tl.where(tmp33, tmp41, tmp42)
    tmp44 = tmp0 >= tmp31
    tl.full([1], 4, tl.int64)
    tmp47 = tl.load(in_ptr0 + 4 * x3, tmp44 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp48 = tl.load(in_ptr0 + (1 + 4 * x3), tmp44 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp49 = tmp47 + tmp48
    tmp50 = tl.load(in_ptr0 + (2 + 4 * x3), tmp44 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp51 = tmp49 + tmp50
    tmp52 = tl.load(in_ptr0 + (3 + 4 * x3), tmp44 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp53 = tmp51 + tmp52
    tmp54 = tmp53 * tmp12
    tmp55 = tl.full(tmp54.shape, 0.0, tmp54.dtype)
    tmp56 = tl.where(tmp44, tmp54, tmp55)
    tmp57 = tl.where(tmp33, tmp43, tmp56)
    tmp58 = tl.where(tmp19, tmp29, tmp57)
    tmp59 = tl.where(tmp4, tmp15, tmp58)
    tl.store(out_ptr0 + (x4 + 64 * x2), tmp59, xmask)


@triton.jit
def triton_poi_fused__to_copy_div_sum_2(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 + 16 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp3 = tl.load(in_ptr0 + (2 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp5 = tl.load(in_ptr0 + (3 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp9 = tl.load(in_ptr0 + (4 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp10 = tl.load(in_ptr0 + (5 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp12 = tl.load(in_ptr0 + (6 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp14 = tl.load(in_ptr0 + (7 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp18 = tl.load(in_ptr0 + (8 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp19 = tl.load(in_ptr0 + (9 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp21 = tl.load(in_ptr0 + (10 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr0 + (11 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp27 = tl.load(in_ptr0 + (12 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp28 = tl.load(in_ptr0 + (13 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp30 = tl.load(in_ptr0 + (14 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp32 = tl.load(in_ptr0 + (15 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 0.25
    tmp8 = tmp6 * tmp7
    tmp11 = tmp9 + tmp10
    tmp13 = tmp11 + tmp12
    tmp15 = tmp13 + tmp14
    tmp16 = tmp15 * tmp7
    tmp17 = tmp8 + tmp16
    tmp20 = tmp18 + tmp19
    tmp22 = tmp20 + tmp21
    tmp24 = tmp22 + tmp23
    tmp25 = tmp24 * tmp7
    tmp26 = tmp17 + tmp25
    tmp29 = tmp27 + tmp28
    tmp31 = tmp29 + tmp30
    tmp33 = tmp31 + tmp32
    tmp34 = tmp33 * tmp7
    tmp35 = tmp26 + tmp34
    tl.store(out_ptr0 + x0, tmp35, xmask)


@triton.jit
def triton_poi_fused_cat_3(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 % 4
    x1 = xindex // 4 % 4
    x2 = xindex // 16
    x3 = xindex % 16
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = x1
    tmp7 = tmp5 < tmp3
    tmp8 = tmp7 & tmp4
    tmp9 = tl.load(in_ptr0 + x2, tmp8 & xmask, eviction_policy='evict_last',
        other=0.0)
    tmp10 = 0.0625
    tmp11 = tmp9 * tmp10
    tmp12 = tl.full(tmp11.shape, 0.0, tmp11.dtype)
    tmp13 = tl.where(tmp8, tmp11, tmp12)
    tmp14 = tmp5 >= tmp3
    tmp15 = tl.full([1], 2, tl.int64)
    tmp16 = tmp5 < tmp15
    tmp17 = tmp14 & tmp16
    tmp18 = tmp17 & tmp4
    tmp19 = tl.load(in_ptr0 + x2, tmp18 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp20 = tmp19 * tmp10
    tmp21 = tl.full(tmp20.shape, 0.0, tmp20.dtype)
    tmp22 = tl.where(tmp18, tmp20, tmp21)
    tmp23 = tmp5 >= tmp15
    tmp24 = tl.full([1], 3, tl.int64)
    tmp25 = tmp5 < tmp24
    tmp26 = tmp23 & tmp25
    tmp27 = tmp26 & tmp4
    tmp28 = tl.load(in_ptr0 + x2, tmp27 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp29 = tmp28 * tmp10
    tmp30 = tl.full(tmp29.shape, 0.0, tmp29.dtype)
    tmp31 = tl.where(tmp27, tmp29, tmp30)
    tmp32 = tmp5 >= tmp24
    tl.full([1], 4, tl.int64)
    tmp35 = tmp32 & tmp4
    tmp36 = tl.load(in_ptr0 + x2, tmp35 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp37 = tmp36 * tmp10
    tmp38 = tl.full(tmp37.shape, 0.0, tmp37.dtype)
    tmp39 = tl.where(tmp35, tmp37, tmp38)
    tmp40 = tl.where(tmp26, tmp31, tmp39)
    tmp41 = tl.where(tmp17, tmp22, tmp40)
    tmp42 = tl.where(tmp7, tmp13, tmp41)
    tmp43 = tl.full(tmp42.shape, 0.0, tmp42.dtype)
    tmp44 = tl.where(tmp4, tmp42, tmp43)
    tmp45 = tmp0 >= tmp3
    tmp46 = tmp0 < tmp15
    tmp47 = tmp45 & tmp46
    tmp48 = tmp7 & tmp47
    tmp49 = tl.load(in_ptr0 + x2, tmp48 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp50 = tmp49 * tmp10
    tmp51 = tl.full(tmp50.shape, 0.0, tmp50.dtype)
    tmp52 = tl.where(tmp48, tmp50, tmp51)
    tmp53 = tmp17 & tmp47
    tmp54 = tl.load(in_ptr0 + x2, tmp53 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp55 = tmp54 * tmp10
    tmp56 = tl.full(tmp55.shape, 0.0, tmp55.dtype)
    tmp57 = tl.where(tmp53, tmp55, tmp56)
    tmp58 = tmp26 & tmp47
    tmp59 = tl.load(in_ptr0 + x2, tmp58 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp60 = tmp59 * tmp10
    tmp61 = tl.full(tmp60.shape, 0.0, tmp60.dtype)
    tmp62 = tl.where(tmp58, tmp60, tmp61)
    tmp63 = tmp32 & tmp47
    tmp64 = tl.load(in_ptr0 + x2, tmp63 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp65 = tmp64 * tmp10
    tmp66 = tl.full(tmp65.shape, 0.0, tmp65.dtype)
    tmp67 = tl.where(tmp63, tmp65, tmp66)
    tmp68 = tl.where(tmp26, tmp62, tmp67)
    tmp69 = tl.where(tmp17, tmp57, tmp68)
    tmp70 = tl.where(tmp7, tmp52, tmp69)
    tmp71 = tl.full(tmp70.shape, 0.0, tmp70.dtype)
    tmp72 = tl.where(tmp47, tmp70, tmp71)
    tmp73 = tmp0 >= tmp15
    tmp74 = tmp0 < tmp24
    tmp75 = tmp73 & tmp74
    tmp76 = tmp7 & tmp75
    tmp77 = tl.load(in_ptr0 + x2, tmp76 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp78 = tmp77 * tmp10
    tmp79 = tl.full(tmp78.shape, 0.0, tmp78.dtype)
    tmp80 = tl.where(tmp76, tmp78, tmp79)
    tmp81 = tmp17 & tmp75
    tmp82 = tl.load(in_ptr0 + x2, tmp81 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp83 = tmp82 * tmp10
    tmp84 = tl.full(tmp83.shape, 0.0, tmp83.dtype)
    tmp85 = tl.where(tmp81, tmp83, tmp84)
    tmp86 = tmp26 & tmp75
    tmp87 = tl.load(in_ptr0 + x2, tmp86 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp88 = tmp87 * tmp10
    tmp89 = tl.full(tmp88.shape, 0.0, tmp88.dtype)
    tmp90 = tl.where(tmp86, tmp88, tmp89)
    tmp91 = tmp32 & tmp75
    tmp92 = tl.load(in_ptr0 + x2, tmp91 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp93 = tmp92 * tmp10
    tmp94 = tl.full(tmp93.shape, 0.0, tmp93.dtype)
    tmp95 = tl.where(tmp91, tmp93, tmp94)
    tmp96 = tl.where(tmp26, tmp90, tmp95)
    tmp97 = tl.where(tmp17, tmp85, tmp96)
    tmp98 = tl.where(tmp7, tmp80, tmp97)
    tmp99 = tl.full(tmp98.shape, 0.0, tmp98.dtype)
    tmp100 = tl.where(tmp75, tmp98, tmp99)
    tmp101 = tmp0 >= tmp24
    tmp103 = tmp7 & tmp101
    tmp104 = tl.load(in_ptr0 + x2, tmp103 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp105 = tmp104 * tmp10
    tmp106 = tl.full(tmp105.shape, 0.0, tmp105.dtype)
    tmp107 = tl.where(tmp103, tmp105, tmp106)
    tmp108 = tmp17 & tmp101
    tmp109 = tl.load(in_ptr0 + x2, tmp108 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp110 = tmp109 * tmp10
    tmp111 = tl.full(tmp110.shape, 0.0, tmp110.dtype)
    tmp112 = tl.where(tmp108, tmp110, tmp111)
    tmp113 = tmp26 & tmp101
    tmp114 = tl.load(in_ptr0 + x2, tmp113 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp115 = tmp114 * tmp10
    tmp116 = tl.full(tmp115.shape, 0.0, tmp115.dtype)
    tmp117 = tl.where(tmp113, tmp115, tmp116)
    tmp118 = tmp32 & tmp101
    tmp119 = tl.load(in_ptr0 + x2, tmp118 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp120 = tmp119 * tmp10
    tmp121 = tl.full(tmp120.shape, 0.0, tmp120.dtype)
    tmp122 = tl.where(tmp118, tmp120, tmp121)
    tmp123 = tl.where(tmp26, tmp117, tmp122)
    tmp124 = tl.where(tmp17, tmp112, tmp123)
    tmp125 = tl.where(tmp7, tmp107, tmp124)
    tmp126 = tl.full(tmp125.shape, 0.0, tmp125.dtype)
    tmp127 = tl.where(tmp101, tmp125, tmp126)
    tmp128 = tl.where(tmp75, tmp100, tmp127)
    tmp129 = tl.where(tmp47, tmp72, tmp128)
    tmp130 = tl.where(tmp4, tmp44, tmp129)
    tl.store(out_ptr0 + (x3 + 64 * x2), tmp130, xmask)


@triton.jit
def triton_poi_fused_stack_4(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
    x2 = xindex
    x0 = xindex % 16
    x1 = xindex // 16
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tl.store(out_ptr0 + (x0 + 64 * x1), tmp0, xmask)


@triton.jit
def triton_poi_fused_sum_5(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 16
    xnumel = 16
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y0 = yindex % 4
    y1 = yindex // 4
    tmp0 = tl.load(in_ptr0 + (x2 + 16 * y0 + 256 * y1), xmask & ymask)
    tmp1 = tl.load(in_ptr0 + (64 + x2 + 16 * y0 + 256 * y1), xmask & ymask)
    tmp3 = tl.load(in_ptr0 + (128 + x2 + 16 * y0 + 256 * y1), xmask & ymask)
    tmp5 = tl.load(in_ptr0 + (192 + x2 + 16 * y0 + 256 * y1), xmask & ymask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tl.store(out_ptr0 + (y0 + 4 * x2 + 64 * y1), tmp6, xmask & ymask)


@triton.jit
def triton_poi_fused_add_6(in_out_ptr0, 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_out_ptr0 + x0, xmask)
    tmp1 = tl.load(in_ptr0 + 0)
    tmp2 = tl.broadcast_to(tmp1, [XBLOCK])
    tmp3 = tmp0 + tmp2
    tl.store(in_out_ptr0 + x0, tmp3, xmask)


def call(args):
    primals_1, primals_2, primals_3 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_2, (1, 1, 4), (4, 4, 1))
    assert_size_stride(primals_3, (1, 1, 1, 1), (1, 1, 1, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf5 = empty_strided_cuda((4, 4, 16, 4), (256, 64, 4, 1), torch.float32
            )
        buf0 = reinterpret_tensor(buf5, (4, 4, 4, 4), (256, 64, 4, 1), 16)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(256)](primals_1, buf0, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf1 = reinterpret_tensor(buf5, (4, 4, 4, 4), (256, 64, 4, 1), 32)
        triton_poi_fused_cat_1[grid(256)](primals_1, buf1, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused__to_copy_div_sum_2[grid(16)](primals_1, buf2, 16,
            XBLOCK=16, num_warps=1, num_stages=1)
        buf3 = reinterpret_tensor(buf5, (4, 4, 4, 4), (256, 64, 4, 1), 48)
        triton_poi_fused_cat_3[grid(256)](buf2, buf3, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        del buf2
        buf4 = reinterpret_tensor(buf5, (4, 4, 4, 4), (256, 64, 4, 1), 0)
        triton_poi_fused_stack_4[grid(256)](primals_1, buf4, 256, XBLOCK=
            256, num_warps=4, num_stages=1)
        del primals_1
        buf6 = empty_strided_cuda((4, 1, 4, 4, 4, 1), (64, 64, 16, 4, 1, 1),
            torch.float32)
        triton_poi_fused_sum_5[grid(16, 16)](buf5, buf6, 16, 16, XBLOCK=16,
            YBLOCK=16, num_warps=4, num_stages=1)
        del buf0
        del buf1
        del buf3
        del buf4
        del buf5
        buf7 = empty_strided_cuda((1, 1, 64), (64, 64, 1), torch.float32)
        extern_kernels.bmm(primals_2, reinterpret_tensor(buf6, (1, 4, 64),
            (0, 1, 4), 0), out=buf7)
        del primals_2
        buf8 = reinterpret_tensor(buf7, (4, 1, 4, 4), (16, 16, 4, 1), 0)
        del buf7
        triton_poi_fused_add_6[grid(64)](buf8, primals_3, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        del primals_3
    return buf8, reinterpret_tensor(buf6, (1, 64, 4), (4, 4, 1), 0)


class layer_basicNew(nn.Module):
    """
    :param name: name of layer
    :param input_depth: D
    :param output_depth: S
    :param inputs: N x D x m x m tensor
    :return: output: N x S x m x m tensor
    """

    def __init__(self, input_depth, output_depth, normalization='inf',
        normalization_val=1.0, device='cpu'):
        super().__init__()
        self.input_depth = input_depth
        self.output_depth = output_depth
        self.normalization = normalization
        self.normalization_val = normalization_val
        self.device = device
        self.basis_dimension = 4
        self.coeffs = torch.nn.Parameter(torch.randn(self.input_depth, self
            .output_depth, self.basis_dimension) * np.sqrt(2.0) / (self.
            input_depth + self.output_depth), requires_grad=True)
        self.bias = torch.nn.Parameter(torch.zeros(1, self.output_depth, 1, 1))

    def forward(self, input_0):
        primals_2 = self.coeffs
        primals_3 = self.bias
        primals_1 = input_0
        output = call([primals_1, primals_2, primals_3])
        return output[0]


Measured latency_ms: 0.033101