# AOT ID: ['0_forward']
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/tu/ctuwujqqargp3has2vrf3nh6p675lnlimk3ed4vwhxsy2jloq26v.py
# Topologically Sorted Source Nodes: [conv1d, audio_out], Original ATen: [aten.convolution, aten.relu, aten.threshold_backward]
# Source node to ATen node mapping:
#   audio_out => relu
#   conv1d => convolution
# Graph fragment:
#   %convolution : [num_users=1] = call_function[target=torch.ops.aten.convolution.default](args = (%getitem, %primals_2, %primals_3, [1], [9], [1], False, [0], 1), kwargs = {})
#   %relu : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%convolution,), kwargs = {})
#   %le_1 : [num_users=1] = call_function[target=torch.ops.aten.le.Scalar](args = (%relu, 0), kwargs = {})
triton_poi_fused_convolution_relu_threshold_backward_0 = async_compile.triton('triton_poi_fused_convolution_relu_threshold_backward_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=[2048], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_relu_threshold_backward_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, '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_convolution_relu_threshold_backward_0(in_out_ptr0, in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 1920
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = (xindex // 3) % 40
    tmp0 = tl.load(in_out_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr0 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(in_out_ptr0 + (x3), tmp4, xmask)
    tl.store(out_ptr0 + (x3), tmp6, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/al/calgibmbxp6mzvzldwekeqpugu6csgbtjvsrvftez3h6b3kfdzn3.py
# Topologically Sorted Source Nodes: [audio_out_1], Original ATen: [aten.max_pool2d_with_indices]
# Source node to ATen node mapping:
#   audio_out_1 => _low_memory_max_pool2d_with_offsets, getitem_3
# Graph fragment:
#   %_low_memory_max_pool2d_with_offsets : [num_users=2] = call_function[target=torch.ops.prims._low_memory_max_pool2d_with_offsets.default](args = (%unsqueeze, [1, 2], [1, 2], [0, 1], [1, 1], False), kwargs = {})
#   %getitem_3 : [num_users=1] = call_function[target=operator.getitem](args = (%_low_memory_max_pool2d_with_offsets, 1), kwargs = {})
triton_poi_fused_max_pool2d_with_indices_1 = async_compile.triton('triton_poi_fused_max_pool2d_with_indices_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.pointwise(
    size_hints=[2048], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*i8', 2: '*fp32', 3: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_pool2d_with_indices_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 2, '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_max_pool2d_with_indices_1(in_ptr0, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 1280
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 2
    x1 = (xindex // 2)
    x2 = xindex
    tmp0 = tl.full([1], 0, tl.int64)
    tmp1 = tmp0 >= tmp0
    tmp2 = tl.full([1], 1, tl.int64)
    tmp3 = tmp0 < tmp2
    tmp4 = tmp1 & tmp3
    tmp5 = (-1) + (2*x0)
    tmp6 = tmp5 >= tmp0
    tmp7 = tl.full([1], 3, tl.int64)
    tmp8 = tmp5 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tmp4 & tmp9
    tmp11 = tl.load(in_ptr0 + ((-1) + (2*x0) + (3*x1)), tmp10 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp12 = 2*x0
    tmp13 = tmp12 >= tmp0
    tmp14 = tmp12 < tmp7
    tmp15 = tmp13 & tmp14
    tmp16 = tmp4 & tmp15
    tmp17 = tl.load(in_ptr0 + ((2*x0) + (3*x1)), tmp16 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp18 = tmp17 > tmp11
    tmp19 = tl.full([1], 1, tl.int8)
    tmp20 = tl.full([1], 0, tl.int8)
    tmp21 = tl.where(tmp18, tmp19, tmp20)
    tmp22 = triton_helpers.maximum(tmp17, tmp11)
    tl.store(out_ptr0 + (x2), tmp21, xmask)
    tl.store(out_ptr1 + (x2), tmp22, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/25/c25ptzj556bv6ouaevakwzgigp5hjwwfmlze7r7oyllkolcnlnqb.py
# Topologically Sorted Source Nodes: [conv1d_1, audio_out_2], Original ATen: [aten.convolution, aten.relu, aten.threshold_backward]
# Source node to ATen node mapping:
#   audio_out_2 => relu_1
#   conv1d_1 => convolution_1
# Graph fragment:
#   %convolution_1 : [num_users=1] = call_function[target=torch.ops.aten.convolution.default](args = (%squeeze, %primals_4, %primals_5, [1], [19], [1], False, [0], 1), kwargs = {})
#   %relu_1 : [num_users=2] = call_function[target=torch.ops.aten.relu.default](args = (%convolution_1,), kwargs = {})
#   %le : [num_users=1] = call_function[target=torch.ops.aten.le.Scalar](args = (%relu_1, 0), kwargs = {})
triton_poi_fused_convolution_relu_threshold_backward_2 = async_compile.triton('triton_poi_fused_convolution_relu_threshold_backward_2', '''
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=[1024], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_relu_threshold_backward_2', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 2, '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_convolution_relu_threshold_backward_2(in_out_ptr0, in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 640
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 40
    tmp0 = tl.load(in_out_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr0 + (x0), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(in_out_ptr0 + (x2), tmp4, xmask)
    tl.store(out_ptr0 + (x2), tmp6, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_7/inductor_cache/kp/ckp26uds4kw5frmh7dwknn4baqpixncielhvohpwot7o5gx6orrm.py
# Topologically Sorted Source Nodes: [audio_out_4], Original ATen: [aten.max_pool2d_with_indices]
# Source node to ATen node mapping:
#   audio_out_4 => _low_memory_max_pool2d_with_offsets_1, getitem_5
# Graph fragment:
#   %_low_memory_max_pool2d_with_offsets_1 : [num_users=2] = call_function[target=torch.ops.prims._low_memory_max_pool2d_with_offsets.default](args = (%unsqueeze_1, [1, 10], [1, 10], [0, 4], [1, 1], False), kwargs = {})
#   %getitem_5 : [num_users=1] = call_function[target=operator.getitem](args = (%_low_memory_max_pool2d_with_offsets_1, 1), kwargs = {})
triton_poi_fused_max_pool2d_with_indices_3 = async_compile.triton('triton_poi_fused_max_pool2d_with_indices_3', '''
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: '*i8', 3: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_max_pool2d_with_indices_3', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 10, '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_max_pool2d_with_indices_3(in_ptr0, 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
    x0 = xindex % 4
    x2 = xindex
    tmp0 = tl.full([1], 0, tl.int64)
    tmp1 = tmp0 >= tmp0
    tmp2 = tl.full([1], 1, tl.int64)
    tmp3 = tmp0 < tmp2
    tmp4 = tmp1 & tmp3
    tmp5 = (-4) + (10*x0)
    tmp6 = tmp5 >= tmp0
    tmp7 = tl.full([1], 40, tl.int64)
    tmp8 = tmp5 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tmp4 & tmp9
    tmp11 = tl.load(in_ptr0 + ((-4) + (10*x2)), tmp10 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp12 = (-3) + (10*x0)
    tmp13 = tmp12 >= tmp0
    tmp14 = tmp12 < tmp7
    tmp15 = tmp13 & tmp14
    tmp16 = tmp4 & tmp15
    tmp17 = tl.load(in_ptr0 + ((-3) + (10*x2)), tmp16 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = (-2) + (10*x0)
    tmp20 = tmp19 >= tmp0
    tmp21 = tmp19 < tmp7
    tmp22 = tmp20 & tmp21
    tmp23 = tmp4 & tmp22
    tmp24 = tl.load(in_ptr0 + ((-2) + (10*x2)), tmp23 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = (-1) + (10*x0)
    tmp27 = tmp26 >= tmp0
    tmp28 = tmp26 < tmp7
    tmp29 = tmp27 & tmp28
    tmp30 = tmp4 & tmp29
    tmp31 = tl.load(in_ptr0 + ((-1) + (10*x2)), tmp30 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = 10*x0
    tmp34 = tmp33 >= tmp0
    tmp35 = tmp33 < tmp7
    tmp36 = tmp34 & tmp35
    tmp37 = tmp4 & tmp36
    tmp38 = tl.load(in_ptr0 + (10*x2), tmp37 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp39 = triton_helpers.maximum(tmp38, tmp32)
    tmp40 = 1 + (10*x0)
    tmp41 = tmp40 >= tmp0
    tmp42 = tmp40 < tmp7
    tmp43 = tmp41 & tmp42
    tmp44 = tmp4 & tmp43
    tmp45 = tl.load(in_ptr0 + (1 + (10*x2)), tmp44 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp46 = triton_helpers.maximum(tmp45, tmp39)
    tmp47 = 2 + (10*x0)
    tmp48 = tmp47 >= tmp0
    tmp49 = tmp47 < tmp7
    tmp50 = tmp48 & tmp49
    tmp51 = tmp4 & tmp50
    tmp52 = tl.load(in_ptr0 + (2 + (10*x2)), tmp51 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp53 = triton_helpers.maximum(tmp52, tmp46)
    tmp54 = 3 + (10*x0)
    tmp55 = tmp54 >= tmp0
    tmp56 = tmp54 < tmp7
    tmp57 = tmp55 & tmp56
    tmp58 = tmp4 & tmp57
    tmp59 = tl.load(in_ptr0 + (3 + (10*x2)), tmp58 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp60 = triton_helpers.maximum(tmp59, tmp53)
    tmp61 = 4 + (10*x0)
    tmp62 = tmp61 >= tmp0
    tmp63 = tmp61 < tmp7
    tmp64 = tmp62 & tmp63
    tmp65 = tmp4 & tmp64
    tmp66 = tl.load(in_ptr0 + (4 + (10*x2)), tmp65 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp67 = triton_helpers.maximum(tmp66, tmp60)
    tmp68 = 5 + (10*x0)
    tmp69 = tmp68 >= tmp0
    tmp70 = tmp68 < tmp7
    tmp71 = tmp69 & tmp70
    tmp72 = tmp4 & tmp71
    tmp73 = tl.load(in_ptr0 + (5 + (10*x2)), tmp72 & xmask, eviction_policy='evict_last', other=float("-inf"))
    tmp74 = triton_helpers.maximum(tmp73, tmp67)
    tmp75 = tmp17 > tmp11
    tmp76 = tl.full([1], 1, tl.int8)
    tmp77 = tl.full([1], 0, tl.int8)
    tmp78 = tl.where(tmp75, tmp76, tmp77)
    tmp79 = tmp24 > tmp18
    tmp80 = tl.full([1], 2, tl.int8)
    tmp81 = tl.where(tmp79, tmp80, tmp78)
    tmp82 = tmp31 > tmp25
    tmp83 = tl.full([1], 3, tl.int8)
    tmp84 = tl.where(tmp82, tmp83, tmp81)
    tmp85 = tmp38 > tmp32
    tmp86 = tl.full([1], 4, tl.int8)
    tmp87 = tl.where(tmp85, tmp86, tmp84)
    tmp88 = tmp45 > tmp39
    tmp89 = tl.full([1], 5, tl.int8)
    tmp90 = tl.where(tmp88, tmp89, tmp87)
    tmp91 = tmp52 > tmp46
    tmp92 = tl.full([1], 6, tl.int8)
    tmp93 = tl.where(tmp91, tmp92, tmp90)
    tmp94 = tmp59 > tmp53
    tmp95 = tl.full([1], 7, tl.int8)
    tmp96 = tl.where(tmp94, tmp95, tmp93)
    tmp97 = tmp66 > tmp60
    tmp98 = tl.full([1], 8, tl.int8)
    tmp99 = tl.where(tmp97, tmp98, tmp96)
    tmp100 = tmp73 > tmp67
    tmp101 = tl.full([1], 9, tl.int8)
    tmp102 = tl.where(tmp100, tmp101, tmp99)
    tl.store(out_ptr0 + (x2), tmp74, xmask)
    tl.store(out_ptr1 + (x2), tmp102, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    primals_1, primals_2, primals_3, primals_4, primals_5 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (40, 1, 20), (20, 20, 1))
    assert_size_stride(primals_3, (40, ), (1, ))
    assert_size_stride(primals_4, (40, 40, 40), (1600, 40, 1))
    assert_size_stride(primals_5, (40, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        # Topologically Sorted Source Nodes: [x_1], Original ATen: [aten.native_dropout]
        buf0 = torch.ops.aten.native_dropout.default(reinterpret_tensor(primals_1, (16, 1, 4), (4, 4, 1), 0), 0.5, True)
        del primals_1
        buf1 = buf0[0]
        del buf0
        # Topologically Sorted Source Nodes: [conv1d], Original ATen: [aten.convolution]
        buf3 = extern_kernels.convolution(buf1, primals_2, stride=(1,), padding=(9,), dilation=(1,), transposed=False, output_padding=(0,), groups=1, bias=None)
        assert_size_stride(buf3, (16, 40, 3), (120, 3, 1))
        buf4 = buf3; del buf3  # reuse
        buf12 = empty_strided_cuda((16, 40, 3), (120, 3, 1), torch.bool)
        # Topologically Sorted Source Nodes: [conv1d, audio_out], Original ATen: [aten.convolution, aten.relu, aten.threshold_backward]
        stream0 = get_raw_stream(0)
        triton_poi_fused_convolution_relu_threshold_backward_0.run(buf4, primals_3, buf12, 1920, grid=grid(1920), stream=stream0)
        del primals_3
        buf5 = empty_strided_cuda((16, 40, 1, 2), (80, 2, 2, 1), torch.int8)
        buf6 = empty_strided_cuda((16, 40, 1, 2), (80, 2, 2, 1), torch.float32)
        # Topologically Sorted Source Nodes: [audio_out_1], Original ATen: [aten.max_pool2d_with_indices]
        triton_poi_fused_max_pool2d_with_indices_1.run(buf4, buf5, buf6, 1280, grid=grid(1280), stream=stream0)
        # Topologically Sorted Source Nodes: [conv1d_1], Original ATen: [aten.convolution]
        buf7 = extern_kernels.convolution(reinterpret_tensor(buf6, (16, 40, 2), (80, 2, 1), 0), primals_4, stride=(1,), padding=(19,), dilation=(1,), transposed=False, output_padding=(0,), groups=1, bias=None)
        assert_size_stride(buf7, (16, 40, 1), (40, 1, 1))
        buf8 = buf7; del buf7  # reuse
        buf11 = empty_strided_cuda((16, 40, 1), (40, 1, 1), torch.bool)
        # Topologically Sorted Source Nodes: [conv1d_1, audio_out_2], Original ATen: [aten.convolution, aten.relu, aten.threshold_backward]
        triton_poi_fused_convolution_relu_threshold_backward_2.run(buf8, primals_5, buf11, 640, grid=grid(640), stream=stream0)
        del primals_5
        buf9 = empty_strided_cuda((16, 1, 1, 4), (4, 4, 4, 1), torch.float32)
        buf10 = empty_strided_cuda((16, 1, 1, 4), (4, 4, 4, 1), torch.int8)
        # Topologically Sorted Source Nodes: [audio_out_4], Original ATen: [aten.max_pool2d_with_indices]
        triton_poi_fused_max_pool2d_with_indices_3.run(buf8, buf9, buf10, 64, grid=grid(64), stream=stream0)
    return (reinterpret_tensor(buf9, (4, 4, 4), (16, 4, 1), 0), primals_2, primals_4, buf1, reinterpret_tensor(buf4, (16, 40, 1, 3), (120, 3, 3, 1), 0), buf5, reinterpret_tensor(buf6, (16, 40, 2), (80, 2, 1), 0), reinterpret_tensor(buf8, (16, 1, 1, 40), (40, 40, 40, 1), 0), buf10, buf11, buf12, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    primals_1 = rand_strided((4, 4, 4), (16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((40, 1, 20), (20, 20, 1), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((40, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((40, 40, 40), (1600, 40, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((40, ), (1, ), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([primals_1, primals_2, primals_3, primals_4, primals_5])
    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 numpy as np
from torch import nn
import torch.nn.functional as F


class Emo16(nn.Module):

    def __init__(self, input_size: 'int', num_channels: 'int'=40):
        """ 
        Speech emotion recognition model proposed in:
        
        `Trigeorgis, G., Ringeval, F., Brueckner, R., Marchi, E., Nicolaou, M. A., Schuller, B., & Zafeiriou, S. 
        Adieu features? end-to-end speech emotion recognition using a deep convolutional recurrent network. 
        In 2016 IEEE international conference on acoustics, speech and signal processing (ICASSP) (pp. 5200-5204). IEEE.`
        
        Args:
            input_size (int): Input size to the model. 
            num_channels (int): Number of channels to use in the convolution layers (default `40`). 
        """
        super(Emo16, self).__init__()
        self.conv1 = nn.Conv1d(in_channels=1, out_channels=num_channels,
            kernel_size=20, stride=1, padding=9)
        self.max_pool1 = nn.MaxPool1d(2, 2, padding=1)
        self.conv2 = nn.Conv1d(in_channels=40, out_channels=num_channels,
            kernel_size=40, stride=1, padding=19)
        self.max_pool2 = nn.MaxPool1d(10, 10, padding=4)
        self.num_features = int(np.ceil(input_size / 2)) * 4 - 4
        self.reset_parameters()

    def reset_parameters(self):
        """ Initialize parameters of the model."""
        for m in list(self.modules()):
            self._init_weights(m)

    def _init_weights(self, m):
        """ Helper method to initialize the parameters of the model 
            with Kaiming uniform initialization.
        """
        if type(m) == nn.Conv1d or type(m) == nn.Linear:
            nn.init.kaiming_uniform_(m.weight)
            nn.init.zeros_(m.bias)

    def forward(self, x: 'torch.Tensor'):
        """ Forward pass.
        
        Args:
            x ((torch.Tensor) - BS x S x 1 x T)
        """
        batch_size, seq_length, t = x.shape
        x = x.view(batch_size * seq_length, 1, t)
        x = F.dropout(x)
        audio_out = F.relu(self.conv1(x))
        audio_out = self.max_pool1(audio_out)
        audio_out = F.relu(self.conv2(audio_out))
        _, c2, t2 = audio_out.shape
        audio_out = audio_out.view(batch_size * seq_length, t2, c2)
        audio_out = self.max_pool2(audio_out)
        audio_out = audio_out.view(batch_size, seq_length, -1)
        return audio_out


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


def get_init_inputs():
    return [[], {'input_size': 4}]

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
import numpy as np
from torch import 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_convolution_relu_threshold_backward_0(in_out_ptr0,
    in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 1920
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 3 % 40
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(in_out_ptr0 + x3, tmp4, xmask)
    tl.store(out_ptr0 + x3, tmp6, xmask)


@triton.jit
def triton_poi_fused_max_pool2d_with_indices_1(in_ptr0, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 1280
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 2
    x1 = xindex // 2
    x2 = xindex
    tmp0 = tl.full([1], 0, tl.int64)
    tmp1 = tmp0 >= tmp0
    tmp2 = tl.full([1], 1, tl.int64)
    tmp3 = tmp0 < tmp2
    tmp4 = tmp1 & tmp3
    tmp5 = -1 + 2 * x0
    tmp6 = tmp5 >= tmp0
    tmp7 = tl.full([1], 3, tl.int64)
    tmp8 = tmp5 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tmp4 & tmp9
    tmp11 = tl.load(in_ptr0 + (-1 + 2 * x0 + 3 * x1), tmp10 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp12 = 2 * x0
    tmp13 = tmp12 >= tmp0
    tmp14 = tmp12 < tmp7
    tmp15 = tmp13 & tmp14
    tmp16 = tmp4 & tmp15
    tmp17 = tl.load(in_ptr0 + (2 * x0 + 3 * x1), tmp16 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp18 = tmp17 > tmp11
    tmp19 = tl.full([1], 1, tl.int8)
    tmp20 = tl.full([1], 0, tl.int8)
    tmp21 = tl.where(tmp18, tmp19, tmp20)
    tmp22 = triton_helpers.maximum(tmp17, tmp11)
    tl.store(out_ptr0 + x2, tmp21, xmask)
    tl.store(out_ptr1 + x2, tmp22, xmask)


@triton.jit
def triton_poi_fused_convolution_relu_threshold_backward_2(in_out_ptr0,
    in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 640
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 40
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(in_out_ptr0 + x2, tmp4, xmask)
    tl.store(out_ptr0 + x2, tmp6, xmask)


@triton.jit
def triton_poi_fused_max_pool2d_with_indices_3(in_ptr0, 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
    x0 = xindex % 4
    x2 = xindex
    tmp0 = tl.full([1], 0, tl.int64)
    tmp1 = tmp0 >= tmp0
    tmp2 = tl.full([1], 1, tl.int64)
    tmp3 = tmp0 < tmp2
    tmp4 = tmp1 & tmp3
    tmp5 = -4 + 10 * x0
    tmp6 = tmp5 >= tmp0
    tmp7 = tl.full([1], 40, tl.int64)
    tmp8 = tmp5 < tmp7
    tmp9 = tmp6 & tmp8
    tmp10 = tmp4 & tmp9
    tmp11 = tl.load(in_ptr0 + (-4 + 10 * x2), tmp10 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp12 = -3 + 10 * x0
    tmp13 = tmp12 >= tmp0
    tmp14 = tmp12 < tmp7
    tmp15 = tmp13 & tmp14
    tmp16 = tmp4 & tmp15
    tmp17 = tl.load(in_ptr0 + (-3 + 10 * x2), tmp16 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = -2 + 10 * x0
    tmp20 = tmp19 >= tmp0
    tmp21 = tmp19 < tmp7
    tmp22 = tmp20 & tmp21
    tmp23 = tmp4 & tmp22
    tmp24 = tl.load(in_ptr0 + (-2 + 10 * x2), tmp23 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = -1 + 10 * x0
    tmp27 = tmp26 >= tmp0
    tmp28 = tmp26 < tmp7
    tmp29 = tmp27 & tmp28
    tmp30 = tmp4 & tmp29
    tmp31 = tl.load(in_ptr0 + (-1 + 10 * x2), tmp30 & xmask,
        eviction_policy='evict_last', other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = 10 * x0
    tmp34 = tmp33 >= tmp0
    tmp35 = tmp33 < tmp7
    tmp36 = tmp34 & tmp35
    tmp37 = tmp4 & tmp36
    tmp38 = tl.load(in_ptr0 + 10 * x2, tmp37 & xmask, eviction_policy=
        'evict_last', other=float('-inf'))
    tmp39 = triton_helpers.maximum(tmp38, tmp32)
    tmp40 = 1 + 10 * x0
    tmp41 = tmp40 >= tmp0
    tmp42 = tmp40 < tmp7
    tmp43 = tmp41 & tmp42
    tmp44 = tmp4 & tmp43
    tmp45 = tl.load(in_ptr0 + (1 + 10 * x2), tmp44 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp46 = triton_helpers.maximum(tmp45, tmp39)
    tmp47 = 2 + 10 * x0
    tmp48 = tmp47 >= tmp0
    tmp49 = tmp47 < tmp7
    tmp50 = tmp48 & tmp49
    tmp51 = tmp4 & tmp50
    tmp52 = tl.load(in_ptr0 + (2 + 10 * x2), tmp51 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp53 = triton_helpers.maximum(tmp52, tmp46)
    tmp54 = 3 + 10 * x0
    tmp55 = tmp54 >= tmp0
    tmp56 = tmp54 < tmp7
    tmp57 = tmp55 & tmp56
    tmp58 = tmp4 & tmp57
    tmp59 = tl.load(in_ptr0 + (3 + 10 * x2), tmp58 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp60 = triton_helpers.maximum(tmp59, tmp53)
    tmp61 = 4 + 10 * x0
    tmp62 = tmp61 >= tmp0
    tmp63 = tmp61 < tmp7
    tmp64 = tmp62 & tmp63
    tmp65 = tmp4 & tmp64
    tmp66 = tl.load(in_ptr0 + (4 + 10 * x2), tmp65 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp67 = triton_helpers.maximum(tmp66, tmp60)
    tmp68 = 5 + 10 * x0
    tmp69 = tmp68 >= tmp0
    tmp70 = tmp68 < tmp7
    tmp71 = tmp69 & tmp70
    tmp72 = tmp4 & tmp71
    tmp73 = tl.load(in_ptr0 + (5 + 10 * x2), tmp72 & xmask, eviction_policy
        ='evict_last', other=float('-inf'))
    tmp74 = triton_helpers.maximum(tmp73, tmp67)
    tmp75 = tmp17 > tmp11
    tmp76 = tl.full([1], 1, tl.int8)
    tmp77 = tl.full([1], 0, tl.int8)
    tmp78 = tl.where(tmp75, tmp76, tmp77)
    tmp79 = tmp24 > tmp18
    tmp80 = tl.full([1], 2, tl.int8)
    tmp81 = tl.where(tmp79, tmp80, tmp78)
    tmp82 = tmp31 > tmp25
    tmp83 = tl.full([1], 3, tl.int8)
    tmp84 = tl.where(tmp82, tmp83, tmp81)
    tmp85 = tmp38 > tmp32
    tmp86 = tl.full([1], 4, tl.int8)
    tmp87 = tl.where(tmp85, tmp86, tmp84)
    tmp88 = tmp45 > tmp39
    tmp89 = tl.full([1], 5, tl.int8)
    tmp90 = tl.where(tmp88, tmp89, tmp87)
    tmp91 = tmp52 > tmp46
    tmp92 = tl.full([1], 6, tl.int8)
    tmp93 = tl.where(tmp91, tmp92, tmp90)
    tmp94 = tmp59 > tmp53
    tmp95 = tl.full([1], 7, tl.int8)
    tmp96 = tl.where(tmp94, tmp95, tmp93)
    tmp97 = tmp66 > tmp60
    tmp98 = tl.full([1], 8, tl.int8)
    tmp99 = tl.where(tmp97, tmp98, tmp96)
    tmp100 = tmp73 > tmp67
    tmp101 = tl.full([1], 9, tl.int8)
    tmp102 = tl.where(tmp100, tmp101, tmp99)
    tl.store(out_ptr0 + x2, tmp74, xmask)
    tl.store(out_ptr1 + x2, tmp102, xmask)


def call(args):
    primals_1, primals_2, primals_3, primals_4, primals_5 = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (40, 1, 20), (20, 20, 1))
    assert_size_stride(primals_3, (40,), (1,))
    assert_size_stride(primals_4, (40, 40, 40), (1600, 40, 1))
    assert_size_stride(primals_5, (40,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = torch.ops.aten.native_dropout.default(reinterpret_tensor(
            primals_1, (16, 1, 4), (4, 4, 1), 0), 0.5, True)
        del primals_1
        buf1 = buf0[0]
        del buf0
        buf3 = extern_kernels.convolution(buf1, primals_2, stride=(1,),
            padding=(9,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf3, (16, 40, 3), (120, 3, 1))
        buf4 = buf3
        del buf3
        buf12 = empty_strided_cuda((16, 40, 3), (120, 3, 1), torch.bool)
        get_raw_stream(0)
        triton_poi_fused_convolution_relu_threshold_backward_0[grid(1920)](buf4
            , primals_3, buf12, 1920, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_3
        buf5 = empty_strided_cuda((16, 40, 1, 2), (80, 2, 2, 1), torch.int8)
        buf6 = empty_strided_cuda((16, 40, 1, 2), (80, 2, 2, 1), torch.float32)
        triton_poi_fused_max_pool2d_with_indices_1[grid(1280)](buf4, buf5,
            buf6, 1280, XBLOCK=256, num_warps=4, num_stages=1)
        buf7 = extern_kernels.convolution(reinterpret_tensor(buf6, (16, 40,
            2), (80, 2, 1), 0), primals_4, stride=(1,), padding=(19,),
            dilation=(1,), transposed=False, output_padding=(0,), groups=1,
            bias=None)
        assert_size_stride(buf7, (16, 40, 1), (40, 1, 1))
        buf8 = buf7
        del buf7
        buf11 = empty_strided_cuda((16, 40, 1), (40, 1, 1), torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_2[grid(640)](buf8,
            primals_5, buf11, 640, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_5
        buf9 = empty_strided_cuda((16, 1, 1, 4), (4, 4, 4, 1), torch.float32)
        buf10 = empty_strided_cuda((16, 1, 1, 4), (4, 4, 4, 1), torch.int8)
        triton_poi_fused_max_pool2d_with_indices_3[grid(64)](buf8, buf9,
            buf10, 64, XBLOCK=64, num_warps=1, num_stages=1)
    return reinterpret_tensor(buf9, (4, 4, 4), (16, 4, 1), 0
        ), primals_2, primals_4, buf1, reinterpret_tensor(buf4, (16, 40, 1,
        3), (120, 3, 3, 1), 0), buf5, reinterpret_tensor(buf6, (16, 40, 2),
        (80, 2, 1), 0), reinterpret_tensor(buf8, (16, 1, 1, 40), (40, 40, 
        40, 1), 0), buf10, buf11, buf12


class Emo16New(nn.Module):

    def __init__(self, input_size: 'int', num_channels: 'int'=40):
        """ 
        Speech emotion recognition model proposed in:
        
        `Trigeorgis, G., Ringeval, F., Brueckner, R., Marchi, E., Nicolaou, M. A., Schuller, B., & Zafeiriou, S. 
        Adieu features? end-to-end speech emotion recognition using a deep convolutional recurrent network. 
        In 2016 IEEE international conference on acoustics, speech and signal processing (ICASSP) (pp. 5200-5204). IEEE.`
        
        Args:
            input_size (int): Input size to the model. 
            num_channels (int): Number of channels to use in the convolution layers (default `40`). 
        """
        super(Emo16New, self).__init__()
        self.conv1 = nn.Conv1d(in_channels=1, out_channels=num_channels,
            kernel_size=20, stride=1, padding=9)
        self.max_pool1 = nn.MaxPool1d(2, 2, padding=1)
        self.conv2 = nn.Conv1d(in_channels=40, out_channels=num_channels,
            kernel_size=40, stride=1, padding=19)
        self.max_pool2 = nn.MaxPool1d(10, 10, padding=4)
        self.num_features = int(np.ceil(input_size / 2)) * 4 - 4
        self.reset_parameters()

    def reset_parameters(self):
        """ Initialize parameters of the model."""
        for m in list(self.modules()):
            self._init_weights(m)

    def _init_weights(self, m):
        """ Helper method to initialize the parameters of the model 
            with Kaiming uniform initialization.
        """
        if type(m) == nn.Conv1d or type(m) == nn.Linear:
            nn.init.kaiming_uniform_(m.weight)
            nn.init.zeros_(m.bias)

    def forward(self, input_0):
        primals_2 = self.conv1.weight
        primals_3 = self.conv1.bias
        primals_4 = self.conv2.weight
        primals_5 = self.conv2.bias
        primals_1 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4, primals_5])
        return output[0]
