# AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _align as align
from torch import device, empty_strided
from torch._inductor.async_compile import AsyncCompile
from torch._inductor.select_algorithm import extern_kernels
from torch._inductor.codegen.multi_kernel import MultiKernelCall
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph
from torch._C import _cuda_getCurrentRawStream as get_raw_stream

aten = torch.ops.aten
inductor_ops = torch.ops.inductor
_quantized = torch.ops._quantized
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
alloc_from_pool = torch.ops.inductor._alloc_from_pool
async_compile = AsyncCompile()


# kernel path: runs/run_shard_7/inductor_cache/tj/ctjbmwt35tocrsjintgle62gzxqejpbz23aqczfhtpow3xiuftzn.py
# Topologically Sorted Source Nodes: [softmax, log_softmax, softmax_1, log_softmax_1], Original ATen: [aten._softmax, aten._log_softmax]
# Source node to ATen node mapping:
#   log_softmax => amax_1, sub_1
#   log_softmax_1 => amax_3, sub_4
#   softmax => amax, exp, sub
#   softmax_1 => amax_2, exp_2, sub_3
# Graph fragment:
#   %amax : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%arg0_1, [1], True), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %amax), kwargs = {})
#   %exp : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub,), kwargs = {})
#   %amax_1 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%arg0_1, [1], True), kwargs = {})
#   %sub_1 : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %amax_1), kwargs = {})
#   %amax_2 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%arg0_1, [2], True), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %amax_2), kwargs = {})
#   %exp_2 : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub_3,), kwargs = {})
#   %amax_3 : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%arg0_1, [2], True), kwargs = {})
#   %sub_4 : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %amax_3), kwargs = {})
triton_poi_fused__log_softmax__softmax_0 = async_compile.triton('triton_poi_fused__log_softmax__softmax_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__log_softmax__softmax_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 9, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused__log_softmax__softmax_0(in_ptr0, out_ptr0, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x4 = xindex
    x0 = xindex % 4
    x2 = (xindex // 16)
    x3 = (xindex // 4)
    tmp0 = tl.load(in_ptr0 + (x4), xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (4 + x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (8 + x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (12 + x0 + (16*x2)), xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr0 + (4*x3), xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr0 + (1 + (4*x3)), xmask, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr0 + (2 + (4*x3)), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr0 + (3 + (4*x3)), 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
    tmp9 = tl_math.exp(tmp8)
    tmp12 = triton_helpers.maximum(tmp10, tmp11)
    tmp14 = triton_helpers.maximum(tmp12, tmp13)
    tmp16 = triton_helpers.maximum(tmp14, tmp15)
    tmp17 = tmp0 - tmp16
    tmp18 = tl_math.exp(tmp17)
    tl.store(out_ptr0 + (x4), tmp9, xmask)
    tl.store(out_ptr1 + (x4), tmp8, xmask)
    tl.store(out_ptr2 + (x4), tmp18, xmask)
    tl.store(out_ptr3 + (x4), tmp17, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/ke/ckeb46iywnlf3z4xue26e2sw5c7wrwfgojpznlicmcgvsg4fowy2.py
# Topologically Sorted Source Nodes: [softmax, log_softmax, ent_p2g, sum_1, mul_2, softmax_1, log_softmax_1, ent_g2p, sum_2, ent_sum, truediv], Original ATen: [aten._softmax, aten._log_softmax, aten.mul, aten.sum, aten.sub, aten.div]
# Source node to ATen node mapping:
#   ent_g2p => mul_1
#   ent_p2g => mul
#   ent_sum => sub_6
#   log_softmax => exp_1, log, sub_2, sum_2
#   log_softmax_1 => exp_3, log_1, sub_5, sum_4
#   mul_2 => mul_2
#   softmax => div, sum_1
#   softmax_1 => div_1, sum_3
#   sum_1 => sum_5
#   sum_2 => sum_6
#   truediv => div_2
# Graph fragment:
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp, [1], True), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp, %sum_1), kwargs = {})
#   %exp_1 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%sub_1,), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_1, [1], True), kwargs = {})
#   %log : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%sum_2,), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub_1, %log), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%div, %sub_2), kwargs = {})
#   %sum_5 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%view,), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sum_5, -1.0), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_2, [2], True), kwargs = {})
#   %div_1 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp_2, %sum_3), kwargs = {})
#   %exp_3 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%sub_4,), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_3, [2], True), kwargs = {})
#   %log_1 : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%sum_4,), kwargs = {})
#   %sub_5 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%sub_4, %log_1), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%div_1, %sub_5), kwargs = {})
#   %sum_6 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%view_1,), kwargs = {})
#   %sub_6 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_2, %sum_6), kwargs = {})
#   %div_2 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%sub_6, 16), kwargs = {})
triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1 = async_compile.triton('triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.persistent_reduction(
    size_hints=[1, 64],
    reduction_hint=ReductionHint.DEFAULT,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: 'i32', 6: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {5: 1}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 6), equal_to_1=(5,))]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 20, 'num_reduction': 2, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}
)
@triton.jit
def triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, xnumel, rnumel, XBLOCK : tl.constexpr):
    xnumel = 1
    rnumel = 64
    RBLOCK: tl.constexpr = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = tl.full([XBLOCK, RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[None, :]
    roffset = 0
    rmask = tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r3 = rindex
    r0 = rindex % 4
    r2 = (rindex // 16)
    r4 = (rindex // 4)
    tmp0 = tl.load(in_ptr0 + (r3), None)
    tmp1 = tl.load(in_ptr0 + (r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (4 + r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (8 + r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (12 + r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + (r3), None)
    tmp10 = tl.load(in_ptr1 + (r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr1 + (4 + r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr1 + (8 + r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr1 + (12 + r0 + (16*r2)), None, eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr2 + (r3), None)
    tmp28 = tl.load(in_ptr2 + (4*r4), None, eviction_policy='evict_last')
    tmp29 = tl.load(in_ptr2 + (1 + (4*r4)), None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr2 + (2 + (4*r4)), None, eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr2 + (3 + (4*r4)), None, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr3 + (r3), None)
    tmp37 = tl.load(in_ptr3 + (4*r4), None, eviction_policy='evict_last')
    tmp39 = tl.load(in_ptr3 + (1 + (4*r4)), None, eviction_policy='evict_last')
    tmp42 = tl.load(in_ptr3 + (2 + (4*r4)), None, eviction_policy='evict_last')
    tmp45 = tl.load(in_ptr3 + (3 + (4*r4)), None, eviction_policy='evict_last')
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tmp11 = tl_math.exp(tmp10)
    tmp13 = tl_math.exp(tmp12)
    tmp14 = tmp11 + tmp13
    tmp16 = tl_math.exp(tmp15)
    tmp17 = tmp14 + tmp16
    tmp19 = tl_math.exp(tmp18)
    tmp20 = tmp17 + tmp19
    tmp21 = tl_math.log(tmp20)
    tmp22 = tmp9 - tmp21
    tmp23 = tmp8 * tmp22
    tmp24 = tl.broadcast_to(tmp23, [XBLOCK, RBLOCK])
    tmp26 = tl.sum(tmp24, 1)[:, None]
    tmp30 = tmp28 + tmp29
    tmp32 = tmp30 + tmp31
    tmp34 = tmp32 + tmp33
    tmp35 = tmp27 / tmp34
    tmp38 = tl_math.exp(tmp37)
    tmp40 = tl_math.exp(tmp39)
    tmp41 = tmp38 + tmp40
    tmp43 = tl_math.exp(tmp42)
    tmp44 = tmp41 + tmp43
    tmp46 = tl_math.exp(tmp45)
    tmp47 = tmp44 + tmp46
    tmp48 = tl_math.log(tmp47)
    tmp49 = tmp36 - tmp48
    tmp50 = tmp35 * tmp49
    tmp51 = tl.broadcast_to(tmp50, [XBLOCK, RBLOCK])
    tmp53 = tl.sum(tmp51, 1)[:, None]
    tmp54 = -1.0
    tmp55 = tmp26 * tmp54
    tmp56 = tmp55 - tmp53
    tmp57 = 0.0625
    tmp58 = tmp56 * tmp57
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp58, None)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4), (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)
        buf1 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf4 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf5 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [softmax, log_softmax, softmax_1, log_softmax_1], Original ATen: [aten._softmax, aten._log_softmax]
        stream0 = get_raw_stream(0)
        triton_poi_fused__log_softmax__softmax_0.run(arg0_1, buf0, buf1, buf4, buf5, 64, grid=grid(64), stream=stream0)
        del arg0_1
        buf3 = empty_strided_cuda((), (), torch.float32)
        buf8 = buf3; del buf3  # reuse
        # Topologically Sorted Source Nodes: [softmax, log_softmax, ent_p2g, sum_1, mul_2, softmax_1, log_softmax_1, ent_g2p, sum_2, ent_sum, truediv], Original ATen: [aten._softmax, aten._log_softmax, aten.mul, aten.sum, aten.sub, aten.div]
        triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1.run(buf8, buf0, buf1, buf4, buf5, 1, 64, grid=grid(1), stream=stream0)
        del buf0
        del buf1
        del buf4
        del buf5
    return (buf8, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    arg0_1 = rand_strided((4, 4, 4), (16, 4, 1), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([arg0_1])
    return print_performance(fn, times=times, repeat=repeat)


if __name__ == "__main__":
    from torch._inductor.wrapper_benchmark import compiled_module_main
    compiled_module_main('None', benchmark_compiled_module)

import torch
import torch.nn.functional as F
import torch.nn as nn


class Entropy(nn.Module):

    def __init__(self):
        super(Entropy, self).__init__()

    def forward(self, x):
        num, ms1, ms2 = x.size()
        ent_p2g = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
        ent_g2p = F.softmax(x, dim=2) * F.log_softmax(x, dim=2)
        ent_sum = -1.0 * ent_p2g.view(num, -1).sum() - ent_g2p.view(num, -1
            ).sum()
        return ent_sum / (ms1 * ms2)


def get_inputs():
    return [torch.rand([4, 4, 4])]


def get_init_inputs():
    return [[], {}]

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._inductor.runtime.triton_helpers import math as tl_math
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


@triton.jit
def triton_poi_fused__log_softmax__softmax_0(in_ptr0, out_ptr0, out_ptr1,
    out_ptr2, out_ptr3, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x4 = xindex
    x0 = xindex % 4
    x2 = xindex // 16
    x3 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x4, xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp2 = tl.load(in_ptr0 + (4 + x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr0 + (8 + x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr0 + (12 + x0 + 16 * x2), xmask, eviction_policy=
        'evict_last')
    tmp10 = tl.load(in_ptr0 + 4 * x3, xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr0 + (1 + 4 * x3), xmask, eviction_policy='evict_last'
        )
    tmp13 = tl.load(in_ptr0 + (2 + 4 * x3), xmask, eviction_policy='evict_last'
        )
    tmp15 = tl.load(in_ptr0 + (3 + 4 * x3), 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
    tmp9 = tl_math.exp(tmp8)
    tmp12 = triton_helpers.maximum(tmp10, tmp11)
    tmp14 = triton_helpers.maximum(tmp12, tmp13)
    tmp16 = triton_helpers.maximum(tmp14, tmp15)
    tmp17 = tmp0 - tmp16
    tmp18 = tl_math.exp(tmp17)
    tl.store(out_ptr0 + x4, tmp9, xmask)
    tl.store(out_ptr1 + x4, tmp8, xmask)
    tl.store(out_ptr2 + x4, tmp18, xmask)
    tl.store(out_ptr3 + x4, tmp17, xmask)


@triton.jit
def triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1(in_out_ptr0,
    in_ptr0, in_ptr1, in_ptr2, in_ptr3, xnumel, rnumel, XBLOCK: tl.constexpr):
    RBLOCK: tl.constexpr = 64
    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)
    r3 = rindex
    r0 = rindex % 4
    r2 = rindex // 16
    r4 = rindex // 4
    tmp0 = tl.load(in_ptr0 + r3, None)
    tmp1 = tl.load(in_ptr0 + (r0 + 16 * r2), None, eviction_policy='evict_last'
        )
    tmp2 = tl.load(in_ptr0 + (4 + r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr0 + (8 + r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr0 + (12 + r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp9 = tl.load(in_ptr1 + r3, None)
    tmp10 = tl.load(in_ptr1 + (r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp12 = tl.load(in_ptr1 + (4 + r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp15 = tl.load(in_ptr1 + (8 + r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp18 = tl.load(in_ptr1 + (12 + r0 + 16 * r2), None, eviction_policy=
        'evict_last')
    tmp27 = tl.load(in_ptr2 + r3, None)
    tmp28 = tl.load(in_ptr2 + 4 * r4, None, eviction_policy='evict_last')
    tmp29 = tl.load(in_ptr2 + (1 + 4 * r4), None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr2 + (2 + 4 * r4), None, eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr2 + (3 + 4 * r4), None, eviction_policy='evict_last')
    tmp36 = tl.load(in_ptr3 + r3, None)
    tmp37 = tl.load(in_ptr3 + 4 * r4, None, eviction_policy='evict_last')
    tmp39 = tl.load(in_ptr3 + (1 + 4 * r4), None, eviction_policy='evict_last')
    tmp42 = tl.load(in_ptr3 + (2 + 4 * r4), None, eviction_policy='evict_last')
    tmp45 = tl.load(in_ptr3 + (3 + 4 * r4), None, eviction_policy='evict_last')
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tmp11 = tl_math.exp(tmp10)
    tmp13 = tl_math.exp(tmp12)
    tmp14 = tmp11 + tmp13
    tmp16 = tl_math.exp(tmp15)
    tmp17 = tmp14 + tmp16
    tmp19 = tl_math.exp(tmp18)
    tmp20 = tmp17 + tmp19
    tmp21 = tl_math.log(tmp20)
    tmp22 = tmp9 - tmp21
    tmp23 = tmp8 * tmp22
    tmp24 = tl.broadcast_to(tmp23, [XBLOCK, RBLOCK])
    tmp26 = tl.sum(tmp24, 1)[:, None]
    tmp30 = tmp28 + tmp29
    tmp32 = tmp30 + tmp31
    tmp34 = tmp32 + tmp33
    tmp35 = tmp27 / tmp34
    tmp38 = tl_math.exp(tmp37)
    tmp40 = tl_math.exp(tmp39)
    tmp41 = tmp38 + tmp40
    tmp43 = tl_math.exp(tmp42)
    tmp44 = tmp41 + tmp43
    tmp46 = tl_math.exp(tmp45)
    tmp47 = tmp44 + tmp46
    tmp48 = tl_math.log(tmp47)
    tmp49 = tmp36 - tmp48
    tmp50 = tmp35 * tmp49
    tmp51 = tl.broadcast_to(tmp50, [XBLOCK, RBLOCK])
    tmp53 = tl.sum(tmp51, 1)[:, None]
    tmp54 = -1.0
    tmp55 = tmp26 * tmp54
    tmp56 = tmp55 - tmp53
    tmp57 = 0.0625
    tmp58 = tmp56 * tmp57
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp58, None)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4), (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)
        buf1 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf4 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf5 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused__log_softmax__softmax_0[grid(64)](arg0_1, buf0,
            buf1, buf4, buf5, 64, XBLOCK=64, num_warps=1, num_stages=1)
        del arg0_1
        buf3 = empty_strided_cuda((), (), torch.float32)
        buf8 = buf3
        del buf3
        triton_per_fused__log_softmax__softmax_div_mul_sub_sum_1[grid(1)](buf8,
            buf0, buf1, buf4, buf5, 1, 64, XBLOCK=1, num_warps=2, num_stages=1)
        del buf0
        del buf1
        del buf4
        del buf5
    return buf8,


class EntropyNew(nn.Module):

    def __init__(self):
        super(EntropyNew, self).__init__()

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