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 import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_poi_fused_fill_lift_fresh_0(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex
    tmp0 = x2
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = tmp5 == tmp5
    tmp7 = tl.full([1], 1, tl.int32)
    tmp8 = tmp1 == tmp7
    tmp9 = tmp3 == tmp7
    tmp10 = tmp7 == tmp5
    tmp11 = tmp3 == tmp5
    tmp12 = -1.0
    tmp13 = 1.0
    tmp14 = tl.where(tmp11, tmp12, tmp13)
    tmp15 = tl.where(tmp10, tmp14, tmp13)
    tmp16 = tl.where(tmp6, tmp15, tmp13)
    tmp17 = tl.where(tmp9, tmp12, tmp16)
    tmp18 = tmp1 == tmp5
    tmp19 = tl.where(tmp18, tmp14, tmp13)
    tmp20 = tl.where(tmp6, tmp19, tmp13)
    tmp21 = tl.where(tmp8, tmp17, tmp20)
    tmp22 = tl.where(tmp6, tmp21, tmp20)
    tmp23 = tl.where(tmp4, tmp12, tmp22)
    tmp24 = tmp0 == tmp7
    tmp25 = tmp0 == tmp5
    tmp26 = tl.where(tmp25, tmp14, tmp13)
    tmp27 = tl.where(tmp6, tmp26, tmp13)
    tmp28 = tl.where(tmp24, tmp17, tmp27)
    tmp29 = tl.where(tmp6, tmp28, tmp27)
    tmp30 = tl.where(tmp2, tmp23, tmp29)
    tl.store(out_ptr0 + x3, tmp30, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_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
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp7 = tl.load(in_ptr0 + (48 + x3), xmask, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr0 + x4, xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 3, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = tmp5 == tmp5
    tmp8 = tl.full([1], 1, tl.int32)
    tmp9 = tmp1 == tmp8
    tmp10 = tmp3 == tmp8
    tmp11 = tmp8 == tmp5
    tmp12 = tmp3 == tmp5
    tmp13 = -1.0
    tmp14 = 1.0
    tmp15 = tl.where(tmp12, tmp13, tmp14)
    tmp16 = tl.where(tmp11, tmp15, tmp14)
    tmp17 = tl.where(tmp6, tmp16, tmp14)
    tmp18 = tl.where(tmp10, tmp13, tmp17)
    tmp19 = tmp1 == tmp5
    tmp20 = tl.where(tmp19, tmp15, tmp14)
    tmp21 = tl.where(tmp6, tmp20, tmp14)
    tmp22 = tl.where(tmp9, tmp18, tmp21)
    tmp23 = tl.where(tmp6, tmp22, tmp21)
    tmp24 = tl.where(tmp6, tmp7, tmp23)
    tmp25 = tl.where(tmp4, tmp13, tmp24)
    tmp27 = tmp0 == tmp8
    tmp28 = tmp0 == tmp5
    tmp29 = tl.where(tmp28, tmp15, tmp14)
    tmp30 = tl.where(tmp6, tmp29, tmp14)
    tmp31 = tl.where(tmp27, tmp18, tmp30)
    tmp32 = tl.where(tmp6, tmp31, tmp30)
    tmp33 = tl.where(tmp6, tmp26, tmp32)
    tmp34 = tl.where(tmp2, tmp25, tmp33)
    tl.store(out_ptr0 + x4, tmp34, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_2(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
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp7 = tl.load(in_ptr0 + x3, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr1 + x3, xmask, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr0 + x4, xmask)
    tmp27 = tl.load(in_ptr1 + x4, xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1], 1, tl.int32)
    tmp6 = tmp5 == tmp1
    tmp9 = tmp1 == tmp5
    tmp10 = tmp3 == tmp5
    tmp11 = tmp1 == tmp1
    tmp12 = -1.0
    tmp13 = 1.0
    tmp14 = tl.where(tmp4, tmp12, tmp13)
    tmp15 = tl.where(tmp6, tmp14, tmp13)
    tmp16 = tl.where(tmp11, tmp15, tmp13)
    tmp17 = tl.where(tmp10, tmp12, tmp16)
    tmp18 = tl.where(tmp11, tmp14, tmp13)
    tmp19 = tl.where(tmp11, tmp18, tmp13)
    tmp20 = tl.where(tmp9, tmp17, tmp19)
    tmp21 = tl.where(tmp6, tmp18, tmp13)
    tmp22 = tl.where(tmp6, tmp20, tmp21)
    tmp23 = tl.where(tmp6, tmp8, tmp22)
    tmp24 = tl.where(tmp6, tmp7, tmp23)
    tmp25 = tl.where(tmp4, tmp12, tmp24)
    tmp28 = tmp0 == tmp5
    tmp29 = tl.where(tmp2, tmp14, tmp13)
    tmp30 = tl.where(tmp11, tmp29, tmp13)
    tmp31 = tl.where(tmp28, tmp17, tmp30)
    tmp32 = tl.where(tmp6, tmp29, tmp13)
    tmp33 = tl.where(tmp6, tmp31, tmp32)
    tmp34 = tl.where(tmp6, tmp27, tmp33)
    tmp35 = tl.where(tmp6, tmp26, tmp34)
    tmp36 = tl.where(tmp2, tmp25, tmp35)
    tl.store(out_ptr0 + x4, tmp36, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_3(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp6 = tl.load(in_ptr0 + (16 + x3), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + (16 + x3), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr2 + (16 + x3), xmask, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr0 + x4, xmask)
    tmp27 = tl.load(in_ptr1 + x4, xmask)
    tmp28 = tl.load(in_ptr2 + x4, xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 1, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tmp1 == tmp1
    tmp7 = tl.full([1], 0, tl.int32)
    tmp8 = tmp1 == tmp7
    tmp11 = tmp7 == tmp7
    tmp12 = tmp3 == tmp7
    tmp13 = -1.0
    tmp14 = 1.0
    tmp15 = tl.where(tmp12, tmp13, tmp14)
    tmp16 = tl.where(tmp8, tmp15, tmp14)
    tmp17 = tl.where(tmp11, tmp16, tmp14)
    tmp18 = tl.where(tmp4, tmp13, tmp17)
    tmp19 = tl.where(tmp5, tmp18, tmp17)
    tmp20 = tl.where(tmp8, tmp16, tmp14)
    tmp21 = tl.where(tmp8, tmp19, tmp20)
    tmp22 = tl.where(tmp8, tmp10, tmp21)
    tmp23 = tl.where(tmp8, tmp9, tmp22)
    tmp24 = tl.where(tmp5, tmp6, tmp23)
    tmp25 = tl.where(tmp4, tmp13, tmp24)
    tmp29 = tmp0 == tmp7
    tmp30 = tl.where(tmp29, tmp15, tmp14)
    tmp31 = tl.where(tmp11, tmp30, tmp14)
    tmp32 = tl.where(tmp2, tmp18, tmp31)
    tmp33 = tl.where(tmp8, tmp30, tmp14)
    tmp34 = tl.where(tmp8, tmp32, tmp33)
    tmp35 = tl.where(tmp8, tmp28, tmp34)
    tmp36 = tl.where(tmp8, tmp27, tmp35)
    tmp37 = tl.where(tmp5, tmp26, tmp36)
    tmp38 = tl.where(tmp2, tmp25, tmp37)
    tl.store(out_ptr0 + x4, tmp38, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_ones_like_4(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
    x3 = xindex // 64
    x4 = xindex % 64
    x2 = xindex // 16 % 4
    x1 = xindex // 4 % 4
    x5 = xindex
    tmp3 = tl.load(in_ptr0 + x4, xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr1 + x4, xmask, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr2 + x4, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr3 + x4, xmask, eviction_policy='evict_last')
    tmp0 = x3
    tmp1 = tl.full([1], 1, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = tmp0 == tmp5
    tmp9 = x2
    tmp10 = tmp9 == tmp1
    tmp11 = x1
    tmp12 = tmp11 == tmp1
    tmp13 = tmp5 == tmp5
    tmp14 = tmp1 == tmp5
    tmp15 = tmp11 == tmp5
    tmp16 = -1.0
    tmp17 = 1.0
    tmp18 = tl.where(tmp15, tmp16, tmp17)
    tmp19 = tl.where(tmp14, tmp18, tmp17)
    tmp20 = tl.where(tmp13, tmp19, tmp17)
    tmp21 = tl.where(tmp12, tmp16, tmp20)
    tmp22 = tmp9 == tmp5
    tmp23 = tl.where(tmp22, tmp18, tmp17)
    tmp24 = tl.where(tmp13, tmp23, tmp17)
    tmp25 = tl.where(tmp10, tmp21, tmp24)
    tmp26 = tl.where(tmp6, tmp23, tmp17)
    tmp27 = tl.where(tmp6, tmp25, tmp26)
    tmp28 = tl.where(tmp6, tmp8, tmp27)
    tmp29 = tl.where(tmp6, tmp7, tmp28)
    tmp30 = tl.where(tmp2, tmp4, tmp29)
    tmp31 = tl.where(tmp2, tmp3, tmp30)
    tl.store(out_ptr0 + x5, tmp31, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_5(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
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp14 = tl.load(in_ptr0 + (96 + x3), xmask, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr0 + (112 + x3), xmask, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr0 + (64 + x3), xmask, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr0 + (128 + x3), xmask, eviction_policy='evict_last')
    tmp32 = tl.load(in_ptr0 + (64 + x4), xmask)
    tmp36 = tl.load(in_ptr0 + (128 + x4), xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1], 2, tl.int32)
    tmp6 = tl.full([1], 1, tl.int32)
    tmp7 = tmp5 == tmp6
    tmp8 = tl.full([1], 3, tl.int32)
    tmp9 = tmp1 == tmp8
    tmp10 = tmp3 == tmp8
    tmp11 = tmp6 == tmp6
    tmp12 = tmp8 == tmp5
    tmp13 = tmp3 == tmp5
    tmp15 = -1.0
    tmp16 = tl.where(tmp13, tmp15, tmp14)
    tmp18 = tl.where(tmp12, tmp16, tmp17)
    tmp19 = tl.where(tmp11, tmp18, tmp17)
    tmp20 = tl.where(tmp10, tmp15, tmp19)
    tmp21 = tmp1 == tmp5
    tmp23 = tl.where(tmp21, tmp16, tmp22)
    tmp24 = tl.where(tmp11, tmp23, tmp22)
    tmp25 = tl.where(tmp9, tmp20, tmp24)
    tmp27 = tl.where(tmp7, tmp23, tmp26)
    tmp28 = tl.where(tmp7, tmp25, tmp27)
    tmp29 = tl.where(tmp4, tmp15, tmp28)
    tmp30 = tmp0 == tmp8
    tmp31 = tmp0 == tmp5
    tmp33 = tl.where(tmp31, tmp16, tmp32)
    tmp34 = tl.where(tmp11, tmp33, tmp32)
    tmp35 = tl.where(tmp30, tmp20, tmp34)
    tmp37 = tl.where(tmp7, tmp33, tmp36)
    tmp38 = tl.where(tmp7, tmp35, tmp37)
    tmp39 = tl.where(tmp2, tmp29, tmp38)
    tl.store(out_ptr0 + x4, tmp39, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_6(in_ptr0, in_ptr1, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex // 64
    x4 = xindex % 64
    x2 = xindex // 16 % 4
    x1 = xindex // 4 % 4
    x6 = xindex % 16
    x7 = xindex
    tmp3 = tl.load(in_ptr0 + x4, xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr1 + (96 + x6), xmask, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr1 + (112 + x6), xmask, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr1 + (64 + x4), xmask, eviction_policy='evict_last')
    tmp26 = tl.load(in_ptr1 + x7, xmask)
    tmp0 = x3
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp4 = tl.full([1], 1, tl.int32)
    tmp5 = tmp0 == tmp4
    tmp6 = x2
    tmp7 = tl.full([1], 3, tl.int32)
    tmp8 = tmp6 == tmp7
    tmp9 = x1
    tmp10 = tmp9 == tmp7
    tmp11 = tmp4 == tmp4
    tmp12 = tmp7 == tmp1
    tmp13 = tmp9 == tmp1
    tmp15 = -1.0
    tmp16 = tl.where(tmp13, tmp15, tmp14)
    tmp18 = tl.where(tmp12, tmp16, tmp17)
    tmp19 = tl.where(tmp11, tmp18, tmp17)
    tmp20 = tl.where(tmp10, tmp15, tmp19)
    tmp21 = tmp6 == tmp1
    tmp23 = tl.where(tmp21, tmp16, tmp22)
    tmp24 = tl.where(tmp11, tmp23, tmp22)
    tmp25 = tl.where(tmp8, tmp20, tmp24)
    tmp27 = tl.where(tmp5, tmp23, tmp26)
    tmp28 = tl.where(tmp5, tmp25, tmp27)
    tmp29 = tl.where(tmp2, tmp3, tmp28)
    tl.store(out_ptr0 + x7, tmp29, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_7(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
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp12 = tl.load(in_ptr0 + (144 + x3), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr0 + (160 + x3), xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr0 + (176 + x3), xmask, eviction_policy='evict_last')
    tmp28 = tl.load(in_ptr0 + (128 + x4), xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 3, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1], 2, tl.int32)
    tmp6 = tmp5 == tmp5
    tmp7 = tmp1 == tmp5
    tmp8 = tmp3 == tmp5
    tmp9 = tl.full([1], 1, tl.int32)
    tmp10 = tmp5 == tmp9
    tmp11 = tmp3 == tmp9
    tmp13 = -1.0
    tmp14 = tl.where(tmp11, tmp13, tmp12)
    tmp16 = tl.where(tmp10, tmp14, tmp15)
    tmp17 = tl.where(tmp6, tmp16, tmp15)
    tmp18 = tl.where(tmp8, tmp13, tmp17)
    tmp19 = tmp1 == tmp9
    tmp21 = tl.where(tmp19, tmp14, tmp20)
    tmp22 = tl.where(tmp6, tmp21, tmp20)
    tmp23 = tl.where(tmp7, tmp18, tmp22)
    tmp24 = tl.where(tmp6, tmp23, tmp22)
    tmp25 = tl.where(tmp4, tmp13, tmp24)
    tmp26 = tmp0 == tmp5
    tmp27 = tmp0 == tmp9
    tmp29 = tl.where(tmp27, tmp14, tmp28)
    tmp30 = tl.where(tmp6, tmp29, tmp28)
    tmp31 = tl.where(tmp26, tmp18, tmp30)
    tmp32 = tl.where(tmp6, tmp31, tmp30)
    tmp33 = tl.where(tmp2, tmp25, tmp32)
    tl.store(out_ptr0 + x4, tmp33, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_8(in_ptr0, in_ptr1, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex // 64
    x4 = xindex % 64
    x2 = xindex // 16 % 4
    x1 = xindex // 4 % 4
    x6 = xindex % 16
    x7 = xindex
    tmp3 = tl.load(in_ptr0 + x4, xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr1 + (144 + x6), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr1 + (160 + x6), xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr1 + (128 + x4), xmask, eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr1 + x7, xmask)
    tmp0 = x3
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp4 = x2
    tmp5 = tmp4 == tmp1
    tmp6 = x1
    tmp7 = tmp6 == tmp1
    tmp8 = tmp1 == tmp1
    tmp9 = tl.full([1], 1, tl.int32)
    tmp10 = tmp1 == tmp9
    tmp11 = tmp6 == tmp9
    tmp13 = -1.0
    tmp14 = tl.where(tmp11, tmp13, tmp12)
    tmp16 = tl.where(tmp10, tmp14, tmp15)
    tmp17 = tl.where(tmp8, tmp16, tmp15)
    tmp18 = tl.where(tmp7, tmp13, tmp17)
    tmp19 = tmp4 == tmp9
    tmp21 = tl.where(tmp19, tmp14, tmp20)
    tmp22 = tl.where(tmp8, tmp21, tmp20)
    tmp23 = tl.where(tmp5, tmp18, tmp22)
    tmp25 = tl.where(tmp2, tmp21, tmp24)
    tmp26 = tl.where(tmp2, tmp23, tmp25)
    tmp27 = tl.where(tmp2, tmp3, tmp26)
    tl.store(out_ptr0 + x7, tmp27, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_9(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
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp13 = tl.load(in_ptr0 + (192 + x3), xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr0 + (208 + x3), xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr0 + (224 + x3), xmask, eviction_policy='evict_last')
    tmp29 = tl.load(in_ptr0 + (192 + x4), xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = x1
    tmp4 = tmp3 == tmp1
    tmp5 = tl.full([1], 3, tl.int32)
    tmp6 = tmp5 == tmp5
    tmp7 = tl.full([1], 1, tl.int32)
    tmp8 = tmp1 == tmp7
    tmp9 = tmp3 == tmp7
    tmp10 = tl.full([1], 0, tl.int32)
    tmp11 = tmp7 == tmp10
    tmp12 = tmp3 == tmp10
    tmp14 = -1.0
    tmp15 = tl.where(tmp12, tmp14, tmp13)
    tmp17 = tl.where(tmp11, tmp15, tmp16)
    tmp18 = tl.where(tmp6, tmp17, tmp16)
    tmp19 = tl.where(tmp9, tmp14, tmp18)
    tmp20 = tmp1 == tmp10
    tmp22 = tl.where(tmp20, tmp15, tmp21)
    tmp23 = tl.where(tmp6, tmp22, tmp21)
    tmp24 = tl.where(tmp8, tmp19, tmp23)
    tmp25 = tl.where(tmp6, tmp24, tmp23)
    tmp26 = tl.where(tmp4, tmp14, tmp25)
    tmp27 = tmp0 == tmp7
    tmp28 = tmp0 == tmp10
    tmp30 = tl.where(tmp28, tmp15, tmp29)
    tmp31 = tl.where(tmp6, tmp30, tmp29)
    tmp32 = tl.where(tmp27, tmp19, tmp31)
    tmp33 = tl.where(tmp6, tmp32, tmp31)
    tmp34 = tl.where(tmp2, tmp26, tmp33)
    tl.store(out_ptr0 + x4, tmp34, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_10(in_ptr0, in_ptr1, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex // 64
    x4 = xindex % 64
    x2 = xindex // 16 % 4
    x1 = xindex // 4 % 4
    x6 = xindex % 16
    x7 = xindex
    tmp3 = tl.load(in_ptr0 + x4, xmask, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr1 + (192 + x6), xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr1 + (208 + x6), xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr1 + (192 + x4), xmask, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr1 + x7, xmask)
    tmp0 = x3
    tmp1 = tl.full([1], 3, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp4 = x2
    tmp5 = tl.full([1], 1, tl.int32)
    tmp6 = tmp4 == tmp5
    tmp7 = x1
    tmp8 = tmp7 == tmp5
    tmp9 = tmp1 == tmp1
    tmp10 = tl.full([1], 0, tl.int32)
    tmp11 = tmp5 == tmp10
    tmp12 = tmp7 == tmp10
    tmp14 = -1.0
    tmp15 = tl.where(tmp12, tmp14, tmp13)
    tmp17 = tl.where(tmp11, tmp15, tmp16)
    tmp18 = tl.where(tmp9, tmp17, tmp16)
    tmp19 = tl.where(tmp8, tmp14, tmp18)
    tmp20 = tmp4 == tmp10
    tmp22 = tl.where(tmp20, tmp15, tmp21)
    tmp23 = tl.where(tmp9, tmp22, tmp21)
    tmp24 = tl.where(tmp6, tmp19, tmp23)
    tmp26 = tl.where(tmp2, tmp22, tmp25)
    tmp27 = tl.where(tmp2, tmp24, tmp26)
    tmp28 = tl.where(tmp2, tmp3, tmp27)
    tl.store(out_ptr0 + x7, tmp28, xmask)


@triton.jit
def triton_poi_fused_fill_lift_fresh_max_mul_sum_11(in_ptr0, in_ptr1,
    out_ptr0, out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex // 16
    x1 = xindex // 4 % 4
    x3 = xindex % 16
    x4 = xindex
    tmp7 = tl.load(in_ptr0 + (240 + x3), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr0 + (192 + x3), xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr0 + (x3 + 64 * x2), xmask)
    tmp14 = tl.load(in_ptr1 + (x3 + 64 * x2), xmask)
    tmp18 = tl.load(in_ptr0 + (208 + x3), xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr0 + (16 + x3 + 64 * x2), xmask)
    tmp22 = tl.load(in_ptr1 + (16 + x3 + 64 * x2), xmask)
    tmp27 = tl.load(in_ptr0 + (224 + x3), xmask, eviction_policy='evict_last')
    tmp29 = tl.load(in_ptr0 + (32 + x3 + 64 * x2), xmask)
    tmp31 = tl.load(in_ptr1 + (32 + x3 + 64 * x2), xmask)
    tmp36 = tl.load(in_ptr0 + (48 + x3 + 64 * x2), xmask)
    tmp38 = tl.load(in_ptr1 + (48 + x3 + 64 * x2), xmask)
    tmp0 = x2
    tmp1 = tl.full([1], 3, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = tmp3 == tmp1
    tmp5 = x1
    tmp6 = tmp5 == tmp1
    tmp8 = -1.0
    tmp9 = tl.where(tmp6, tmp8, tmp7)
    tmp11 = tl.where(tmp4, tmp9, tmp10)
    tmp13 = tl.where(tmp2, tmp11, tmp12)
    tmp15 = tmp13 * tmp14
    tmp16 = tl.full([1], 1, tl.int32)
    tmp17 = tmp16 == tmp1
    tmp19 = tl.where(tmp17, tmp9, tmp18)
    tmp21 = tl.where(tmp2, tmp19, tmp20)
    tmp23 = tmp21 * tmp22
    tmp24 = triton_helpers.maximum(tmp15, tmp23)
    tmp25 = tl.full([1], 2, tl.int32)
    tmp26 = tmp25 == tmp1
    tmp28 = tl.where(tmp26, tmp9, tmp27)
    tmp30 = tl.where(tmp2, tmp28, tmp29)
    tmp32 = tmp30 * tmp31
    tmp33 = triton_helpers.maximum(tmp24, tmp32)
    tmp34 = tmp1 == tmp1
    tmp35 = tl.where(tmp34, tmp9, tmp7)
    tmp37 = tl.where(tmp2, tmp35, tmp36)
    tmp39 = tmp37 * tmp38
    tmp40 = triton_helpers.maximum(tmp33, tmp39)
    tmp41 = tmp15 + tmp23
    tmp42 = tmp41 + tmp32
    tmp43 = tmp42 + tmp39
    tl.store(out_ptr0 + x4, tmp40, xmask)
    tl.store(out_ptr1 + x4, tmp43, xmask)


@triton.jit
def triton_per_fused_add_max_mean_mul_sum_12(in_out_ptr0, in_ptr0, in_ptr1,
    xnumel, rnumel, XBLOCK: tl.constexpr):
    RBLOCK: tl.constexpr = 16
    xoffset = tl.program_id(0) * XBLOCK
    xoffset + tl.arange(0, XBLOCK)[:, None]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r0 = rindex % 4
    r1 = rindex // 4
    tmp0 = tl.load(in_ptr0 + (r0 + 16 * r1), None)
    tmp1 = tl.load(in_ptr0 + (4 + r0 + 16 * r1), None)
    tmp3 = tl.load(in_ptr0 + (8 + r0 + 16 * r1), None)
    tmp5 = tl.load(in_ptr0 + (12 + r0 + 16 * r1), None)
    tmp7 = tl.load(in_ptr1 + (r0 + 16 * r1), None)
    tmp8 = tl.load(in_ptr1 + (4 + r0 + 16 * r1), None)
    tmp10 = tl.load(in_ptr1 + (8 + r0 + 16 * r1), None)
    tmp12 = tl.load(in_ptr1 + (12 + r0 + 16 * r1), None)
    tmp2 = triton_helpers.maximum(tmp0, tmp1)
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp6 = triton_helpers.maximum(tmp4, tmp5)
    tmp9 = tmp7 + tmp8
    tmp11 = tmp9 + tmp10
    tmp13 = tmp11 + tmp12
    tmp14 = 6e-07
    tmp15 = tmp13 * tmp14
    tmp16 = tmp6 + tmp15
    tmp17 = tl.broadcast_to(tmp16, [XBLOCK, RBLOCK])
    tmp19 = tl.sum(tmp17, 1)[:, None]
    tmp20 = 16.0
    tmp21 = tmp19 / tmp20
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp21, None)


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)
        buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_fill_lift_fresh_0[grid(64)](buf0, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf1 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_fill_lift_fresh_1[grid(64)](buf0, buf1, 64, XBLOCK
            =64, num_warps=1, num_stages=1)
        buf2 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_fill_lift_fresh_2[grid(64)](buf1, buf0, buf2, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf3 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_fill_lift_fresh_3[grid(64)](buf2, buf1, buf0, buf3,
            64, XBLOCK=64, num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_fill_lift_fresh_ones_like_4[grid(256)](buf3, buf2,
            buf1, buf0, buf4, 256, XBLOCK=256, num_warps=4, num_stages=1)
        del buf0
        del buf1
        buf5 = buf3
        del buf3
        triton_poi_fused_fill_lift_fresh_5[grid(64)](buf4, buf5, 64, XBLOCK
            =64, num_warps=1, num_stages=1)
        buf6 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        triton_poi_fused_fill_lift_fresh_6[grid(256)](buf5, buf4, buf6, 256,
            XBLOCK=256, num_warps=4, num_stages=1)
        buf7 = buf5
        del buf5
        triton_poi_fused_fill_lift_fresh_7[grid(64)](buf6, buf7, 64, XBLOCK
            =64, num_warps=1, num_stages=1)
        buf8 = buf4
        del buf4
        triton_poi_fused_fill_lift_fresh_8[grid(256)](buf7, buf6, buf8, 256,
            XBLOCK=256, num_warps=4, num_stages=1)
        buf9 = buf7
        del buf7
        triton_poi_fused_fill_lift_fresh_9[grid(64)](buf8, buf9, 64, XBLOCK
            =64, num_warps=1, num_stages=1)
        buf10 = buf6
        del buf6
        triton_poi_fused_fill_lift_fresh_10[grid(256)](buf9, buf8, buf10, 
            256, XBLOCK=256, num_warps=4, num_stages=1)
        del buf8
        buf11 = buf9
        del buf9
        buf12 = buf2
        del buf2
        triton_poi_fused_fill_lift_fresh_max_mul_sum_11[grid(64)](buf10,
            arg0_1, buf11, buf12, 64, XBLOCK=64, num_warps=1, num_stages=1)
        del arg0_1
        del buf10
        buf13 = empty_strided_cuda((), (), torch.float32)
        buf14 = buf13
        del buf13
        triton_per_fused_add_max_mean_mul_sum_12[grid(1)](buf14, buf11,
            buf12, 1, 16, XBLOCK=1, num_warps=2, num_stages=1)
        del buf11
        del buf12
    return buf14,


class CosLossNew(nn.Module):

    def __init__(self, factor=6e-07, havesum=True, havemax=True):
        super(CosLossNew, self).__init__()
        self.factor = factor
        self.havesum = havesum
        self.havemax = havemax

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


Measured latency_ms: 0.172601