# 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_1/inductor_cache/rp/crpqr7v2mocf55w5tqf2rluj2fiivof3chb7j5hksm3yx7oaiuog.py
# Topologically Sorted Source Nodes: [mul, x_1], Original ATen: [aten.mul, aten.sin]
# Source node to ATen node mapping:
#   mul => mul
#   x_1 => sin
# Graph fragment:
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_1, 30), kwargs = {})
#   %sin : [num_users=1] = call_function[target=torch.ops.aten.sin.default](args = (%mul,), kwargs = {})
triton_poi_fused_mul_sin_0 = async_compile.triton('triton_poi_fused_mul_sin_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=[8192], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_sin_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'B098E03CDA7B8ADC90DAFFDF24A2956451D1B13F297756A5DCC209498AA53705', '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_mul_sin_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 8192
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), None)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + (x0), tmp3, None)
''', device_str='cuda')


# kernel path: runs/run_shard_1/inductor_cache/xo/cxo25nxchct5plsklremj6l5mar7oq2szffajwmqi3fzrhyhvyjf.py
# Topologically Sorted Source Nodes: [mul_1, x_3], Original ATen: [aten.mul, aten.sin]
# Source node to ATen node mapping:
#   mul_1 => mul_1
#   x_3 => sin_1
# Graph fragment:
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_3, 30), kwargs = {})
#   %sin_1 : [num_users=1] = call_function[target=torch.ops.aten.sin.default](args = (%mul_1,), kwargs = {})
triton_poi_fused_mul_sin_1 = async_compile.triton('triton_poi_fused_mul_sin_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=[4096], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_sin_1', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'B098E03CDA7B8ADC90DAFFDF24A2956451D1B13F297756A5DCC209498AA53705', '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_mul_sin_1(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), None)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + (x0), tmp3, None)
''', device_str='cuda')


# kernel path: runs/run_shard_1/inductor_cache/ce/ccegecm3eetxtwhn2vykbv2vudnszc5mx6fdr5gq4ioqfnt2tkz7.py
# Topologically Sorted Source Nodes: [mul_2, x_5], Original ATen: [aten.mul, aten.sin]
# Source node to ATen node mapping:
#   mul_2 => mul_2
#   x_5 => sin_2
# Graph fragment:
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_5, 30), kwargs = {})
#   %sin_2 : [num_users=1] = call_function[target=torch.ops.aten.sin.default](args = (%mul_2,), kwargs = {})
triton_poi_fused_mul_sin_2 = async_compile.triton('triton_poi_fused_mul_sin_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=[2048], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_sin_2', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'B098E03CDA7B8ADC90DAFFDF24A2956451D1B13F297756A5DCC209498AA53705', '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_mul_sin_2(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 2048
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), None)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + (x0), tmp3, None)
''', device_str='cuda')


# kernel path: runs/run_shard_1/inductor_cache/62/c62orso67p6gsv5lsfva45jw3zykzq5szuf7dwa6ooiy55ygbqpf.py
# Topologically Sorted Source Nodes: [mul_3, latent], Original ATen: [aten.mul, aten.sin]
# Source node to ATen node mapping:
#   latent => sin_3
#   mul_3 => mul_3
# Graph fragment:
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%view_7, 30), kwargs = {})
#   %sin_3 : [num_users=2] = call_function[target=torch.ops.aten.sin.default](args = (%mul_3,), kwargs = {})
triton_poi_fused_mul_sin_3 = async_compile.triton('triton_poi_fused_mul_sin_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=[512], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_mul_sin_3', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 1, 'num_reduction': 0, 'backend_hash': 'B098E03CDA7B8ADC90DAFFDF24A2956451D1B13F297756A5DCC209498AA53705', '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_mul_sin_3(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 384
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + (x0), tmp3, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, primals_12, primals_13, primals_14, primals_15, primals_16, primals_17 = args
    args.clear()
    assert_size_stride(primals_1, (128, 4), (4, 1))
    assert_size_stride(primals_2, (128, ), (1, ))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (64, 128), (128, 1))
    assert_size_stride(primals_5, (64, ), (1, ))
    assert_size_stride(primals_6, (32, 64), (64, 1))
    assert_size_stride(primals_7, (32, ), (1, ))
    assert_size_stride(primals_8, (6, 32), (32, 1))
    assert_size_stride(primals_9, (6, ), (1, ))
    assert_size_stride(primals_10, (32, 6), (6, 1))
    assert_size_stride(primals_11, (32, ), (1, ))
    assert_size_stride(primals_12, (64, 32), (32, 1))
    assert_size_stride(primals_13, (64, ), (1, ))
    assert_size_stride(primals_14, (128, 64), (64, 1))
    assert_size_stride(primals_15, (128, ), (1, ))
    assert_size_stride(primals_16, (4, 128), (128, 1))
    assert_size_stride(primals_17, (4, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_2, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 128), (1, 4), 0), alpha=1, beta=1, out=buf0)
        del primals_1
        del primals_2
        buf1 = empty_strided_cuda((4, 4, 4, 128), (2048, 512, 128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul, x_1], Original ATen: [aten.mul, aten.sin]
        stream0 = get_raw_stream(0)
        triton_poi_fused_mul_sin_0.run(buf0, buf1, 8192, grid=grid(8192), stream=stream0)
        buf2 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_2], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_5, reinterpret_tensor(buf1, (64, 128), (128, 1), 0), reinterpret_tensor(primals_4, (128, 64), (1, 128), 0), alpha=1, beta=1, out=buf2)
        del primals_5
        buf3 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul_1, x_3], Original ATen: [aten.mul, aten.sin]
        triton_poi_fused_mul_sin_1.run(buf2, buf3, 4096, grid=grid(4096), stream=stream0)
        buf4 = empty_strided_cuda((64, 32), (32, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_4], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_7, reinterpret_tensor(buf3, (64, 64), (64, 1), 0), reinterpret_tensor(primals_6, (64, 32), (1, 64), 0), alpha=1, beta=1, out=buf4)
        del primals_7
        buf5 = empty_strided_cuda((4, 4, 4, 32), (512, 128, 32, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul_2, x_5], Original ATen: [aten.mul, aten.sin]
        triton_poi_fused_mul_sin_2.run(buf4, buf5, 2048, grid=grid(2048), stream=stream0)
        buf6 = empty_strided_cuda((64, 6), (6, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_6], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_9, reinterpret_tensor(buf5, (64, 32), (32, 1), 0), reinterpret_tensor(primals_8, (32, 6), (1, 32), 0), alpha=1, beta=1, out=buf6)
        del primals_9
        buf7 = empty_strided_cuda((4, 4, 4, 6), (96, 24, 6, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul_3, latent], Original ATen: [aten.mul, aten.sin]
        triton_poi_fused_mul_sin_3.run(buf6, buf7, 384, grid=grid(384), stream=stream0)
        buf8 = empty_strided_cuda((64, 32), (32, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_7], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_11, reinterpret_tensor(buf7, (64, 6), (6, 1), 0), reinterpret_tensor(primals_10, (6, 32), (1, 6), 0), alpha=1, beta=1, out=buf8)
        del primals_11
        buf9 = empty_strided_cuda((4, 4, 4, 32), (512, 128, 32, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul_4, x_8], Original ATen: [aten.mul, aten.sin]
        triton_poi_fused_mul_sin_2.run(buf8, buf9, 2048, grid=grid(2048), stream=stream0)
        buf10 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_9], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_13, reinterpret_tensor(buf9, (64, 32), (32, 1), 0), reinterpret_tensor(primals_12, (32, 64), (1, 32), 0), alpha=1, beta=1, out=buf10)
        del primals_13
        buf11 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul_5, x_10], Original ATen: [aten.mul, aten.sin]
        triton_poi_fused_mul_sin_1.run(buf10, buf11, 4096, grid=grid(4096), stream=stream0)
        buf12 = empty_strided_cuda((64, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_11], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_15, reinterpret_tensor(buf11, (64, 64), (64, 1), 0), reinterpret_tensor(primals_14, (64, 128), (1, 64), 0), alpha=1, beta=1, out=buf12)
        del primals_15
        buf13 = empty_strided_cuda((4, 4, 4, 128), (2048, 512, 128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul_6, x_12], Original ATen: [aten.mul, aten.sin]
        triton_poi_fused_mul_sin_0.run(buf12, buf13, 8192, grid=grid(8192), stream=stream0)
        buf14 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [x_13], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_17, reinterpret_tensor(buf13, (64, 128), (128, 1), 0), reinterpret_tensor(primals_16, (128, 4), (1, 128), 0), alpha=1, beta=1, out=buf14)
        del primals_17
    return (reinterpret_tensor(buf14, (4, 4, 4, 4), (64, 16, 4, 1), 0), buf7, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), buf0, reinterpret_tensor(buf1, (64, 128), (128, 1), 0), buf2, reinterpret_tensor(buf3, (64, 64), (64, 1), 0), buf4, reinterpret_tensor(buf5, (64, 32), (32, 1), 0), buf6, reinterpret_tensor(buf7, (64, 6), (6, 1), 0), buf8, reinterpret_tensor(buf9, (64, 32), (32, 1), 0), buf10, reinterpret_tensor(buf11, (64, 64), (64, 1), 0), buf12, reinterpret_tensor(buf13, (64, 128), (128, 1), 0), primals_16, primals_14, primals_12, primals_10, primals_8, primals_6, primals_4, )


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((128, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((128, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((64, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((32, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((32, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((6, 32), (32, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((6, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((32, 6), (6, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((32, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((64, 32), (32, 1), device='cuda:0', dtype=torch.float32)
    primals_13 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((128, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_15 = rand_strided((128, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_16 = rand_strided((4, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_17 = rand_strided((4, ), (1, ), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, primals_12, primals_13, primals_14, primals_15, primals_16, primals_17])
    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
import torch.nn as nn


class SirenLayer(nn.Module):

    def __init__(self, in_f, out_f, w0=30, is_first=False, is_last=False):
        super().__init__()
        self.in_f = in_f
        self.w0 = w0
        self.linear = nn.Linear(in_f, out_f)
        self.is_first = is_first
        self.is_last = is_last
        self.init_weights()

    def init_weights(self):
        b = 1 / self.in_f if self.is_first else np.sqrt(6 / self.in_f
            ) / self.w0
        with torch.no_grad():
            self.linear.weight.uniform_(-b, b)

    def forward(self, x):
        x = self.linear(x)
        return x if self.is_last else torch.sin(self.w0 * x)


class RefineElasticPendulumModel(torch.nn.Module):

    def __init__(self, in_channels):
        super(RefineElasticPendulumModel, self).__init__()
        self.layer1 = SirenLayer(in_channels, 128, is_first=True)
        self.layer2 = SirenLayer(128, 64)
        self.layer3 = SirenLayer(64, 32)
        self.layer4 = SirenLayer(32, 6)
        self.layer5 = SirenLayer(6, 32)
        self.layer6 = SirenLayer(32, 64)
        self.layer7 = SirenLayer(64, 128)
        self.layer8 = SirenLayer(128, in_channels, is_last=True)

    def forward(self, x):
        x = self.layer1(x)
        x = self.layer2(x)
        x = self.layer3(x)
        latent = self.layer4(x)
        x = self.layer5(latent)
        x = self.layer6(x)
        x = self.layer7(x)
        x = self.layer8(x)
        return x, latent


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


def get_init_inputs():
    return [[], {'in_channels': 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.triton_helpers import math as tl_math
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_mul_sin_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, None)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + x0, tmp3, None)


@triton.jit
def triton_poi_fused_mul_sin_1(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, None)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + x0, tmp3, None)


@triton.jit
def triton_poi_fused_mul_sin_2(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, None)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + x0, tmp3, None)


@triton.jit
def triton_poi_fused_mul_sin_3(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 384
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp1 = 30.0
    tmp2 = tmp0 * tmp1
    tmp3 = tl_math.sin(tmp2)
    tl.store(out_ptr0 + x0, tmp3, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12,
        primals_13, primals_14, primals_15, primals_16, primals_17) = args
    args.clear()
    assert_size_stride(primals_1, (128, 4), (4, 1))
    assert_size_stride(primals_2, (128,), (1,))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (64, 128), (128, 1))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (32, 64), (64, 1))
    assert_size_stride(primals_7, (32,), (1,))
    assert_size_stride(primals_8, (6, 32), (32, 1))
    assert_size_stride(primals_9, (6,), (1,))
    assert_size_stride(primals_10, (32, 6), (6, 1))
    assert_size_stride(primals_11, (32,), (1,))
    assert_size_stride(primals_12, (64, 32), (32, 1))
    assert_size_stride(primals_13, (64,), (1,))
    assert_size_stride(primals_14, (128, 64), (64, 1))
    assert_size_stride(primals_15, (128,), (1,))
    assert_size_stride(primals_16, (4, 128), (128, 1))
    assert_size_stride(primals_17, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 128), (128, 1), torch.float32)
        extern_kernels.addmm(primals_2, reinterpret_tensor(primals_3, (64, 
            4), (4, 1), 0), reinterpret_tensor(primals_1, (4, 128), (1, 4),
            0), alpha=1, beta=1, out=buf0)
        del primals_1
        del primals_2
        buf1 = empty_strided_cuda((4, 4, 4, 128), (2048, 512, 128, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_mul_sin_0[grid(8192)](buf0, buf1, 8192, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf2 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        extern_kernels.addmm(primals_5, reinterpret_tensor(buf1, (64, 128),
            (128, 1), 0), reinterpret_tensor(primals_4, (128, 64), (1, 128),
            0), alpha=1, beta=1, out=buf2)
        del primals_5
        buf3 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch.
            float32)
        triton_poi_fused_mul_sin_1[grid(4096)](buf2, buf3, 4096, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf4 = empty_strided_cuda((64, 32), (32, 1), torch.float32)
        extern_kernels.addmm(primals_7, reinterpret_tensor(buf3, (64, 64),
            (64, 1), 0), reinterpret_tensor(primals_6, (64, 32), (1, 64), 0
            ), alpha=1, beta=1, out=buf4)
        del primals_7
        buf5 = empty_strided_cuda((4, 4, 4, 32), (512, 128, 32, 1), torch.
            float32)
        triton_poi_fused_mul_sin_2[grid(2048)](buf4, buf5, 2048, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf6 = empty_strided_cuda((64, 6), (6, 1), torch.float32)
        extern_kernels.addmm(primals_9, reinterpret_tensor(buf5, (64, 32),
            (32, 1), 0), reinterpret_tensor(primals_8, (32, 6), (1, 32), 0),
            alpha=1, beta=1, out=buf6)
        del primals_9
        buf7 = empty_strided_cuda((4, 4, 4, 6), (96, 24, 6, 1), torch.float32)
        triton_poi_fused_mul_sin_3[grid(384)](buf6, buf7, 384, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf8 = empty_strided_cuda((64, 32), (32, 1), torch.float32)
        extern_kernels.addmm(primals_11, reinterpret_tensor(buf7, (64, 6),
            (6, 1), 0), reinterpret_tensor(primals_10, (6, 32), (1, 6), 0),
            alpha=1, beta=1, out=buf8)
        del primals_11
        buf9 = empty_strided_cuda((4, 4, 4, 32), (512, 128, 32, 1), torch.
            float32)
        triton_poi_fused_mul_sin_2[grid(2048)](buf8, buf9, 2048, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf10 = empty_strided_cuda((64, 64), (64, 1), torch.float32)
        extern_kernels.addmm(primals_13, reinterpret_tensor(buf9, (64, 32),
            (32, 1), 0), reinterpret_tensor(primals_12, (32, 64), (1, 32), 
            0), alpha=1, beta=1, out=buf10)
        del primals_13
        buf11 = empty_strided_cuda((4, 4, 4, 64), (1024, 256, 64, 1), torch
            .float32)
        triton_poi_fused_mul_sin_1[grid(4096)](buf10, buf11, 4096, XBLOCK=
            256, num_warps=4, num_stages=1)
        buf12 = empty_strided_cuda((64, 128), (128, 1), torch.float32)
        extern_kernels.addmm(primals_15, reinterpret_tensor(buf11, (64, 64),
            (64, 1), 0), reinterpret_tensor(primals_14, (64, 128), (1, 64),
            0), alpha=1, beta=1, out=buf12)
        del primals_15
        buf13 = empty_strided_cuda((4, 4, 4, 128), (2048, 512, 128, 1),
            torch.float32)
        triton_poi_fused_mul_sin_0[grid(8192)](buf12, buf13, 8192, XBLOCK=
            128, num_warps=4, num_stages=1)
        buf14 = empty_strided_cuda((64, 4), (4, 1), torch.float32)
        extern_kernels.addmm(primals_17, reinterpret_tensor(buf13, (64, 128
            ), (128, 1), 0), reinterpret_tensor(primals_16, (128, 4), (1, 
            128), 0), alpha=1, beta=1, out=buf14)
        del primals_17
    return (reinterpret_tensor(buf14, (4, 4, 4, 4), (64, 16, 4, 1), 0),
        buf7, reinterpret_tensor(primals_3, (64, 4), (4, 1), 0), buf0,
        reinterpret_tensor(buf1, (64, 128), (128, 1), 0), buf2,
        reinterpret_tensor(buf3, (64, 64), (64, 1), 0), buf4,
        reinterpret_tensor(buf5, (64, 32), (32, 1), 0), buf6,
        reinterpret_tensor(buf7, (64, 6), (6, 1), 0), buf8,
        reinterpret_tensor(buf9, (64, 32), (32, 1), 0), buf10,
        reinterpret_tensor(buf11, (64, 64), (64, 1), 0), buf12,
        reinterpret_tensor(buf13, (64, 128), (128, 1), 0), primals_16,
        primals_14, primals_12, primals_10, primals_8, primals_6, primals_4)


class SirenLayer(nn.Module):

    def __init__(self, in_f, out_f, w0=30, is_first=False, is_last=False):
        super().__init__()
        self.in_f = in_f
        self.w0 = w0
        self.linear = nn.Linear(in_f, out_f)
        self.is_first = is_first
        self.is_last = is_last
        self.init_weights()

    def init_weights(self):
        b = 1 / self.in_f if self.is_first else np.sqrt(6 / self.in_f
            ) / self.w0
        with torch.no_grad():
            self.linear.weight.uniform_(-b, b)

    def forward(self, x):
        x = self.linear(x)
        return x if self.is_last else torch.sin(self.w0 * x)


class RefineElasticPendulumModelNew(torch.nn.Module):

    def __init__(self, in_channels):
        super(RefineElasticPendulumModelNew, self).__init__()
        self.layer1 = SirenLayer(in_channels, 128, is_first=True)
        self.layer2 = SirenLayer(128, 64)
        self.layer3 = SirenLayer(64, 32)
        self.layer4 = SirenLayer(32, 6)
        self.layer5 = SirenLayer(6, 32)
        self.layer6 = SirenLayer(32, 64)
        self.layer7 = SirenLayer(64, 128)
        self.layer8 = SirenLayer(128, in_channels, is_last=True)

    def forward(self, input_0):
        primals_1 = self.layer1.linear.weight
        primals_2 = self.layer1.linear.bias
        primals_4 = self.layer2.linear.weight
        primals_5 = self.layer2.linear.bias
        primals_6 = self.layer3.linear.weight
        primals_7 = self.layer3.linear.bias
        primals_8 = self.layer4.linear.weight
        primals_9 = self.layer4.linear.bias
        primals_10 = self.layer5.linear.weight
        primals_11 = self.layer5.linear.bias
        primals_12 = self.layer6.linear.weight
        primals_13 = self.layer6.linear.bias
        primals_14 = self.layer7.linear.weight
        primals_15 = self.layer7.linear.bias
        primals_16 = self.layer8.linear.weight
        primals_17 = self.layer8.linear.bias
        primals_3 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12, primals_13, primals_14,
            primals_15, primals_16, primals_17])
        return output[0], output[1]
