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.init as torch_init
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_linalg_vector_norm_0(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 5
    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')
    tmp2 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp1 = tmp0 * tmp0
    tmp3 = tmp2 * tmp2
    tmp4 = tmp1 + tmp3
    tmp6 = tmp5 * tmp5
    tmp7 = tmp4 + tmp6
    tmp9 = tmp8 * tmp8
    tmp10 = tmp7 + tmp9
    tmp11 = libdevice.sqrt(tmp10)
    tl.store(out_ptr0 + x0, tmp11, xmask)


@triton.jit
def triton_poi_fused_div_1(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 20
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 / tmp1
    tl.store(out_ptr0 + x2, tmp2, xmask)


@triton.jit
def triton_per_fused_div_linalg_vector_norm_2(in_ptr0, out_ptr1, xnumel,
    rnumel, XBLOCK: tl.constexpr):
    RBLOCK: tl.constexpr = 4
    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
    tmp0 = tl.load(in_ptr0 + r0, None)
    tmp1 = tmp0 * tmp0
    tmp2 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
    tmp4 = tl.sum(tmp2, 1)[:, None]
    tmp5 = libdevice.sqrt(tmp4)
    tmp6 = tmp0 / tmp5
    tl.store(out_ptr1 + tl.broadcast_to(r0, [XBLOCK, RBLOCK]), tmp6, None)


@triton.jit
def triton_poi_fused_div_linalg_vector_norm_3(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
    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 = tmp1 * tmp1
    tmp4 = tmp3 * tmp3
    tmp5 = tmp2 + tmp4
    tmp7 = tmp6 * tmp6
    tmp8 = tmp5 + tmp7
    tmp10 = tmp9 * tmp9
    tmp11 = tmp8 + tmp10
    tmp12 = libdevice.sqrt(tmp11)
    tmp13 = tmp0 / tmp12
    tl.store(out_ptr0 + x2, tmp13, xmask)


@triton.jit
def triton_poi_fused_mul_4(in_out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 80
    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 = 1.0
    tmp2 = tmp0 * tmp1
    tl.store(in_out_ptr0 + x0, tmp2, xmask)


@triton.jit
def triton_poi_fused_mul_sigmoid_5(in_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_out_ptr0 + x0, xmask)
    tmp1 = 1.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl.sigmoid(tmp2)
    tl.store(in_out_ptr0 + x0, tmp3, xmask)


@triton.jit
def triton_poi_fused_div_sum_6(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 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tl.store(out_ptr0 + x2, tmp8, xmask)


@triton.jit
def triton_poi_fused_linalg_vector_norm_7(in_ptr0, out_ptr0, 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')
    tmp2 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp1 = tmp0 * tmp0
    tmp3 = tmp2 * tmp2
    tmp4 = tmp1 + tmp3
    tmp6 = tmp5 * tmp5
    tmp7 = tmp4 + tmp6
    tmp9 = tmp8 * tmp8
    tmp10 = tmp7 + tmp9
    tmp11 = libdevice.sqrt(tmp10)
    tl.store(out_ptr0 + x0, tmp11, xmask)


@triton.jit
def triton_poi_fused_div_8(in_out_ptr0, in_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_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 / tmp1
    tl.store(in_out_ptr0 + x2, tmp2, xmask)


@triton.jit
def triton_poi_fused__softmax_9(in_ptr0, 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 + 5 * x0, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (1 + 5 * x0), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (2 + 5 * x0), xmask, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr0 + (3 + 5 * x0), xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr0 + (4 + 5 * x0), xmask, eviction_policy='evict_last'
        )
    tmp1 = 1.0
    tmp2 = tmp0 * tmp1
    tmp4 = tmp3 * tmp1
    tmp5 = triton_helpers.maximum(tmp2, tmp4)
    tmp7 = tmp6 * tmp1
    tmp8 = triton_helpers.maximum(tmp5, tmp7)
    tmp10 = tmp9 * tmp1
    tmp11 = triton_helpers.maximum(tmp8, tmp10)
    tmp13 = tmp12 * tmp1
    tmp14 = triton_helpers.maximum(tmp11, tmp13)
    tmp15 = tmp2 - tmp14
    tmp16 = tmp15 * tmp1
    tmp17 = tl_math.exp(tmp16)
    tmp18 = tmp4 - tmp14
    tmp19 = tmp18 * tmp1
    tmp20 = tl_math.exp(tmp19)
    tmp21 = tmp17 + tmp20
    tmp22 = tmp7 - tmp14
    tmp23 = tmp22 * tmp1
    tmp24 = tl_math.exp(tmp23)
    tmp25 = tmp21 + tmp24
    tmp26 = tmp10 - tmp14
    tmp27 = tmp26 * tmp1
    tmp28 = tl_math.exp(tmp27)
    tmp29 = tmp25 + tmp28
    tmp30 = tmp13 - tmp14
    tmp31 = tmp30 * tmp1
    tmp32 = tl_math.exp(tmp31)
    tmp33 = tmp29 + tmp32
    tl.store(out_ptr0 + x0, tmp14, xmask)
    tl.store(out_ptr1 + x0, tmp33, xmask)


@triton.jit
def triton_poi_fused__softmax_10(in_out_ptr0, in_ptr0, in_ptr1, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 20
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 5
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp3 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp1 = 1.0
    tmp2 = tmp0 * tmp1
    tmp4 = tmp2 - tmp3
    tmp5 = tmp4 * tmp1
    tmp6 = tl_math.exp(tmp5)
    tmp8 = tmp6 / tmp7
    tl.store(in_out_ptr0 + x2, tmp8, xmask)


@triton.jit
def triton_poi_fused_div_sigmoid_sum_11(in_ptr0, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 5
    x2 = xindex // 20
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp2 = tl.load(in_ptr0 + (x0 + 20 * x2), xmask, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr0 + (5 + x0 + 20 * x2), xmask, eviction_policy=
        'evict_last')
    tmp7 = tl.load(in_ptr0 + (10 + x0 + 20 * x2), xmask, eviction_policy=
        'evict_last')
    tmp10 = tl.load(in_ptr0 + (15 + x0 + 20 * x2), xmask, eviction_policy=
        'evict_last')
    tmp1 = tl.sigmoid(tmp0)
    tmp3 = tl.sigmoid(tmp2)
    tmp5 = tl.sigmoid(tmp4)
    tmp6 = tmp3 + tmp5
    tmp8 = tl.sigmoid(tmp7)
    tmp9 = tmp6 + tmp8
    tmp11 = tl.sigmoid(tmp10)
    tmp12 = tmp9 + tmp11
    tmp13 = tmp1 / tmp12
    tl.store(out_ptr0 + x3, tmp13, xmask)


@triton.jit
def triton_poi_fused_linalg_vector_norm_12(in_ptr0, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 20
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 5
    x1 = xindex // 5
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 20 * x1), xmask)
    tmp2 = tl.load(in_ptr0 + (5 + x0 + 20 * x1), xmask)
    tmp5 = tl.load(in_ptr0 + (10 + x0 + 20 * x1), xmask)
    tmp8 = tl.load(in_ptr0 + (15 + x0 + 20 * x1), xmask)
    tmp1 = tmp0 * tmp0
    tmp3 = tmp2 * tmp2
    tmp4 = tmp1 + tmp3
    tmp6 = tmp5 * tmp5
    tmp7 = tmp4 + tmp6
    tmp9 = tmp8 * tmp8
    tmp10 = tmp7 + tmp9
    tmp11 = libdevice.sqrt(tmp10)
    tl.store(out_ptr0 + x2, tmp11, xmask)


@triton.jit
def triton_poi_fused_div_13(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 80
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 5
    x2 = xindex // 20
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + 5 * x2), xmask, eviction_policy='evict_last'
        )
    tmp2 = tmp0 / tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused__softmax_mul_14(in_ptr0, 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 + x0, xmask)
    tmp3 = tl.load(in_ptr0 + (4 + x0), xmask)
    tmp6 = tl.load(in_ptr0 + (8 + x0), xmask)
    tmp9 = tl.load(in_ptr0 + (12 + x0), xmask)
    tmp12 = tl.load(in_ptr0 + (16 + x0), xmask)
    tmp1 = 1.0
    tmp2 = tmp0 * tmp1
    tmp4 = tmp3 * tmp1
    tmp5 = triton_helpers.maximum(tmp2, tmp4)
    tmp7 = tmp6 * tmp1
    tmp8 = triton_helpers.maximum(tmp5, tmp7)
    tmp10 = tmp9 * tmp1
    tmp11 = triton_helpers.maximum(tmp8, tmp10)
    tmp13 = tmp12 * tmp1
    tmp14 = triton_helpers.maximum(tmp11, tmp13)
    tmp15 = tmp2 - tmp14
    tmp16 = tl_math.exp(tmp15)
    tmp17 = tmp4 - tmp14
    tmp18 = tl_math.exp(tmp17)
    tmp19 = tmp16 + tmp18
    tmp20 = tmp7 - tmp14
    tmp21 = tl_math.exp(tmp20)
    tmp22 = tmp19 + tmp21
    tmp23 = tmp10 - tmp14
    tmp24 = tl_math.exp(tmp23)
    tmp25 = tmp22 + tmp24
    tmp26 = tmp13 - tmp14
    tmp27 = tl_math.exp(tmp26)
    tmp28 = tmp25 + tmp27
    tl.store(out_ptr0 + x0, tmp14, xmask)
    tl.store(out_ptr1 + x0, tmp28, xmask)


@triton.jit
def triton_poi_fused__softmax_mul_15(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    ynumel, xnumel, YBLOCK: tl.constexpr, XBLOCK: tl.constexpr):
    ynumel = 4
    xnumel = 5
    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
    x1 = xindex
    y0 = yindex
    tmp0 = tl.load(in_ptr0 + (y0 + 4 * x1), xmask & ymask, eviction_policy=
        'evict_last')
    tmp3 = tl.load(in_ptr1 + y0, ymask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr2 + y0, ymask, eviction_policy='evict_last')
    tmp1 = 1.0
    tmp2 = tmp0 * tmp1
    tmp4 = tmp2 - tmp3
    tmp5 = tl_math.exp(tmp4)
    tmp7 = tmp5 / tmp6
    tl.store(out_ptr0 + (x1 + 5 * y0), tmp7, xmask & ymask)


def call(args):
    primals_1, primals_2, primals_3 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (5, 4), (4, 1))
    assert_size_stride(primals_3, (1, 4), (4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((5, 1), (1, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_linalg_vector_norm_0[grid(5)](primals_2, buf0, 5,
            XBLOCK=8, num_warps=1, num_stages=1)
        buf1 = empty_strided_cuda((5, 4), (4, 1), torch.float32)
        triton_poi_fused_div_1[grid(20)](primals_2, buf0, buf1, 20, XBLOCK=
            32, num_warps=1, num_stages=1)
        del primals_2
        buf6 = empty_strided_cuda((1, 4), (4, 1), torch.float32)
        triton_per_fused_div_linalg_vector_norm_2[grid(1)](primals_3, buf6,
            1, 4, XBLOCK=1, num_warps=2, num_stages=1)
        buf3 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        triton_poi_fused_div_linalg_vector_norm_3[grid(64)](primals_1, buf3,
            64, XBLOCK=64, num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((1, 16, 5), (80, 5, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf3, (1, 16, 4), (0, 4, 1), 
            0), reinterpret_tensor(buf1, (1, 4, 5), (0, 1, 4), 0), out=buf4)
        buf5 = reinterpret_tensor(buf4, (4, 4, 5), (20, 5, 1), 0)
        del buf4
        triton_poi_fused_mul_4[grid(80)](buf5, 80, XBLOCK=128, num_warps=4,
            num_stages=1)
        buf7 = empty_strided_cuda((1, 16, 1), (16, 1, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf3, (1, 16, 4), (0, 4, 1), 
            0), reinterpret_tensor(buf6, (1, 4, 1), (0, 1, 0), 0), out=buf7)
        buf8 = reinterpret_tensor(buf7, (4, 4), (4, 1), 0)
        del buf7
        triton_poi_fused_mul_sigmoid_5[grid(16)](buf8, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf9 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused_div_sum_6[grid(16)](buf8, buf9, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf10 = empty_strided_cuda((4, 4, 1), (4, 1, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(primals_1, (4, 4, 4), (16, 1,
            4), 0), reinterpret_tensor(buf9, (4, 4, 1), (4, 1, 0), 0), out=
            buf10)
        del buf9
        buf11 = reinterpret_tensor(buf6, (4, 1), (1, 1), 0)
        del buf6
        triton_poi_fused_linalg_vector_norm_7[grid(4)](buf10, buf11, 4,
            XBLOCK=4, num_warps=1, num_stages=1)
        buf12 = reinterpret_tensor(buf10, (4, 4), (4, 1), 0)
        del buf10
        triton_poi_fused_div_8[grid(16)](buf12, buf11, 16, XBLOCK=16,
            num_warps=1, num_stages=1)
        buf13 = empty_strided_cuda((1, 4, 5), (20, 5, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf12, (1, 4, 4), (16, 4, 1),
            0), reinterpret_tensor(buf1, (1, 4, 5), (0, 1, 4), 0), out=buf13)
        buf14 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        buf15 = empty_strided_cuda((4, 1), (1, 4), torch.float32)
        triton_poi_fused__softmax_9[grid(4)](buf13, buf14, buf15, 4, XBLOCK
            =4, num_warps=1, num_stages=1)
        buf16 = reinterpret_tensor(buf13, (4, 5), (5, 1), 0)
        del buf13
        triton_poi_fused__softmax_10[grid(20)](buf16, buf14, buf15, 20,
            XBLOCK=32, num_warps=1, num_stages=1)
        buf17 = empty_strided_cuda((4, 4, 5), (20, 5, 1), torch.float32)
        triton_poi_fused_div_sigmoid_sum_11[grid(80)](buf5, buf17, 80,
            XBLOCK=128, num_warps=4, num_stages=1)
        buf18 = empty_strided_cuda((4, 4, 5), (20, 5, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(primals_1, (4, 4, 4), (16, 1,
            4), 0), buf17, out=buf18)
        del buf17
        buf19 = empty_strided_cuda((4, 5, 1), (5, 1, 1), torch.float32)
        triton_poi_fused_linalg_vector_norm_12[grid(20)](buf18, buf19, 20,
            XBLOCK=32, num_warps=1, num_stages=1)
        buf20 = reinterpret_tensor(buf18, (4, 5, 4), (20, 1, 5), 0)
        del buf18
        triton_poi_fused_div_13[grid(80)](buf20, buf19, 80, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf21 = empty_strided_cuda((5, 4, 1), (4, 1, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(buf20, (5, 4, 4), (1, 20, 5),
            0), reinterpret_tensor(buf1, (5, 4, 1), (4, 1, 1), 0), out=buf21)
        buf22 = buf15
        del buf15
        buf23 = buf14
        del buf14
        triton_poi_fused__softmax_mul_14[grid(4)](buf21, buf22, buf23, 4,
            XBLOCK=4, num_warps=1, num_stages=1)
        buf24 = empty_strided_cuda((4, 5), (5, 1), torch.float32)
        triton_poi_fused__softmax_mul_15[grid(4, 5)](buf21, buf22, buf23,
            buf24, 4, 5, XBLOCK=8, YBLOCK=4, num_warps=1, num_stages=1)
        del buf21
        del buf22
        del buf23
    return (buf16, buf24, buf8, buf5, primals_1, primals_3, buf0, buf1,
        buf5, buf8, buf11, buf12, buf16, buf19, buf20, buf24,
        reinterpret_tensor(buf3, (1, 4, 16), (64, 1, 4), 0))


def calculate_l1_norm(f):
    f_norm = torch.norm(f, p=2, dim=-1, keepdim=True)
    f = torch.div(f, f_norm)
    return f


class SingleStreamNew(nn.Module):

    def __init__(self, args, n_out):
        super().__init__()
        self.n_out = n_out
        self.n_class = args.class_num
        self.scale_factor = args.scale_factor
        self.ac_center = nn.Parameter(torch.zeros(self.n_class + 1, self.n_out)
            )
        torch_init.xavier_uniform_(self.ac_center)
        self.fg_center = nn.Parameter(-1.0 * self.ac_center[-1, ...][None, ...]
            )
        self.sigmoid = nn.Sigmoid()

    def forward(self, input_0):
        primals_2 = self.ac_center
        primals_3 = self.fg_center
        primals_1 = input_0
        output = call([primals_1, primals_2, primals_3])
        return output[0], output[1], output[2], output[3]


Measured latency_ms: 0.067898