# 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_4/inductor_cache/nr/cnr5lgijm7k6doqguie5wuabxlbddrcif6m52y5ztaiztmm5lcyy.py
# Topologically Sorted Source Nodes: [conv2d, x], Original ATen: [aten.convolution, aten.leaky_relu]
# Source node to ATen node mapping:
#   conv2d => convolution
#   x => gt, mul, where
# Graph fragment:
#   %convolution : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%primals_3, %primals_1, %primals_2, [4, 4], [1, 1], [2, 2], False, [0, 0], 1), kwargs = {})
#   %gt : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution, 0), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution, 0.01), kwargs = {})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt, %convolution, %mul), kwargs = {})
triton_poi_fused_convolution_leaky_relu_0 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_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=[131072], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_leaky_relu_0', '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_convolution_leaky_relu_0(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 127008
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = (xindex // 3969) % 8
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x3), tmp4, xmask)
    tl.store(out_ptr1 + (x3), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/4b/c4bz2cpervebzg4ppazym7mfhsu66vmmvrwxuls7xspzyojrcear.py
# Topologically Sorted Source Nodes: [conv2d_1, x_1], Original ATen: [aten.convolution, aten.leaky_relu]
# Source node to ATen node mapping:
#   conv2d_1 => convolution_1
#   x_1 => gt_1, mul_1, where_1
# Graph fragment:
#   %convolution_1 : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%where, %primals_4, %primals_5, [3, 3], [1, 1], [1, 1], False, [0, 0], 1), kwargs = {})
#   %gt_1 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution_1, 0), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution_1, 0.01), kwargs = {})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %convolution_1, %mul_1), kwargs = {})
triton_poi_fused_convolution_leaky_relu_1 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_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=[32768], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_leaky_relu_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_convolution_leaky_relu_1(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 28224
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = (xindex // 441) % 16
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x3), tmp4, xmask)
    tl.store(out_ptr1 + (x3), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/7f/c7fy3q7oposmsrqhqhqkigih2vt5bwmjndsvncunqh3au6dpojja.py
# Topologically Sorted Source Nodes: [conv2d_2, x_2], Original ATen: [aten.convolution, aten.leaky_relu]
# Source node to ATen node mapping:
#   conv2d_2 => convolution_2
#   x_2 => gt_2, mul_2, where_2
# Graph fragment:
#   %convolution_2 : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%where_1, %primals_6, %primals_7, [3, 3], [1, 1], [1, 1], False, [0, 0], 1), kwargs = {})
#   %gt_2 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution_2, 0), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution_2, 0.01), kwargs = {})
#   %where_2 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_2, %convolution_2, %mul_2), kwargs = {})
triton_poi_fused_convolution_leaky_relu_2 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_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=[8192], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_leaky_relu_2', '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_convolution_leaky_relu_2(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 6272
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = (xindex // 49) % 32
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x3), tmp4, xmask)
    tl.store(out_ptr1 + (x3), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/q5/cq52xqbok3l6ca7mgpgiietkweau2kddeft43cwd4iryhre3znj2.py
# Topologically Sorted Source Nodes: [conv2d_3, x_3, adaptive_avg_pool2d], Original ATen: [aten.convolution, aten.leaky_relu, aten.mean]
# Source node to ATen node mapping:
#   adaptive_avg_pool2d => mean
#   conv2d_3 => convolution_3
#   x_3 => gt_3, mul_3, where_3
# Graph fragment:
#   %convolution_3 : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%where_2, %primals_8, %primals_9, [2, 2], [0, 0], [1, 1], False, [0, 0], 1), kwargs = {})
#   %gt_3 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution_3, 0), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution_3, 0.01), kwargs = {})
#   %where_3 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_3, %convolution_3, %mul_3), kwargs = {})
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%where_3, [-1, -2], True), kwargs = {})
triton_poi_fused_convolution_leaky_relu_mean_3 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_mean_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=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*i1', 3: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_leaky_relu_mean_3', '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_convolution_leaky_relu_mean_3(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = 1.0
    tmp9 = tmp7 / tmp8
    tl.store(out_ptr0 + (x2), tmp4, xmask)
    tl.store(out_ptr1 + (x2), tmp9, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/vx/cvxgikvf4odxfy443anpyiuj4co7fllc5yvys3hays4zemvnnsn2.py
# Topologically Sorted Source Nodes: [mul, std, mul_1, sample], Original ATen: [aten.mul, aten.exp, aten.add]
# Source node to ATen node mapping:
#   mul => mul_4
#   mul_1 => mul_5
#   sample => add
#   std => exp
# Graph fragment:
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%addmm_2, 0.5), kwargs = {})
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%mul_4,), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%randn, %exp), kwargs = {})
#   %add : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%addmm_1, %mul_5), kwargs = {})
triton_poi_fused_add_exp_mul_4 = async_compile.triton('triton_poi_fused_add_exp_mul_4', '''
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=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_exp_mul_4', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 3, '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_add_exp_mul_4(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    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 = tl.load(in_ptr1 + (x0), xmask)
    tmp2 = tl.load(in_ptr2 + (x0), xmask)
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tl_math.exp(tmp4)
    tmp6 = tmp1 * tmp5
    tmp7 = tmp0 + tmp6
    tl.store(out_ptr0 + (x0), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/cq/ccq2e5g5kvi7tfbcukwmpfajz5mdminbpvfxlic7hpri5wujde3c.py
# Topologically Sorted Source Nodes: [conv_transpose2d, x_5], Original ATen: [aten.convolution, aten.leaky_relu]
# Source node to ATen node mapping:
#   conv_transpose2d => convolution_4
#   x_5 => gt_4, mul_6, where_4
# Graph fragment:
#   %convolution_4 : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%view_1, %primals_18, %primals_19, [1, 1], [0, 0], [1, 1], True, [0, 0], 1), kwargs = {})
#   %gt_4 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution_4, 0), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution_4, 0.01), kwargs = {})
#   %where_4 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_4, %convolution_4, %mul_6), kwargs = {})
triton_poi_fused_convolution_leaky_relu_5 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_5', '''
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: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_leaky_relu_5', '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_convolution_leaky_relu_5(in_ptr0, in_ptr1, out_ptr0, out_ptr1, 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)
    x3 = xindex
    x1 = (xindex // 16) % 32
    tmp0 = tl.load(in_ptr0 + (x3), None)
    tmp1 = tl.load(in_ptr1 + (x1), None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x3), tmp4, None)
    tl.store(out_ptr1 + (x3), tmp7, None)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/ki/ckihgwoh3acikuliqzor6rewmvcf7cerswmb6huqltlyvmna3vw7.py
# Topologically Sorted Source Nodes: [conv_transpose2d_1, x_6], Original ATen: [aten.convolution, aten.leaky_relu]
# Source node to ATen node mapping:
#   conv_transpose2d_1 => convolution_5
#   x_6 => gt_5, mul_7, where_5
# Graph fragment:
#   %convolution_5 : [num_users=3] = call_function[target=torch.ops.aten.convolution.default](args = (%where_4, %primals_20, %primals_21, [2, 2], [0, 0], [1, 1], True, [0, 0], 1), kwargs = {})
#   %gt_5 : [num_users=2] = call_function[target=torch.ops.aten.gt.Scalar](args = (%convolution_5, 0), kwargs = {})
#   %mul_7 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%convolution_5, 0.01), kwargs = {})
#   %where_5 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%gt_5, %convolution_5, %mul_7), kwargs = {})
triton_poi_fused_convolution_leaky_relu_6 = async_compile.triton('triton_poi_fused_convolution_leaky_relu_6', '''
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: '*i1', 3: '*fp32', 4: '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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_leaky_relu_6', '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_convolution_leaky_relu_6(in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 6400
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = (xindex // 100) % 16
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr1 + (x1), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + (x3), tmp4, xmask)
    tl.store(out_ptr1 + (x3), tmp7, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_4/inductor_cache/3q/c3qz2h27fy6qsibvqlmapk7ijyivrhipmhrk4oddspoivflvrfmz.py
# Topologically Sorted Source Nodes: [conv_transpose2d_2, reconstruction], Original ATen: [aten.convolution, aten.sigmoid]
# Source node to ATen node mapping:
#   conv_transpose2d_2 => convolution_6
#   reconstruction => sigmoid
# Graph fragment:
#   %convolution_6 : [num_users=1] = call_function[target=torch.ops.aten.convolution.default](args = (%where_5, %primals_22, %primals_23, [2, 2], [1, 1], [1, 1], True, [0, 0], 1), kwargs = {})
#   %sigmoid : [num_users=1] = call_function[target=torch.ops.aten.sigmoid.default](args = (%convolution_6,), kwargs = {})
triton_poi_fused_convolution_sigmoid_7 = async_compile.triton('triton_poi_fused_convolution_sigmoid_7', '''
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=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), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_convolution_sigmoid_7', '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_sigmoid_7(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 1764
    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 = tl.load(in_ptr0 + (0))
    tmp2 = tl.broadcast_to(tmp1, [XBLOCK])
    tmp3 = tmp0 + tmp2
    tmp4 = tl.sigmoid(tmp3)
    tl.store(in_out_ptr0 + (x0), tmp4, 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, primals_18, primals_19, primals_20, primals_21, primals_22, primals_23 = args
    args.clear()
    assert_size_stride(primals_1, (8, 3, 4, 4), (48, 16, 4, 1))
    assert_size_stride(primals_2, (8, ), (1, ))
    assert_size_stride(primals_3, (4, 3, 256, 256), (196608, 65536, 256, 1))
    assert_size_stride(primals_4, (16, 8, 4, 4), (128, 16, 4, 1))
    assert_size_stride(primals_5, (16, ), (1, ))
    assert_size_stride(primals_6, (32, 16, 4, 4), (256, 16, 4, 1))
    assert_size_stride(primals_7, (32, ), (1, ))
    assert_size_stride(primals_8, (64, 32, 7, 7), (1568, 49, 7, 1))
    assert_size_stride(primals_9, (64, ), (1, ))
    assert_size_stride(primals_10, (128, 64), (64, 1))
    assert_size_stride(primals_11, (128, ), (1, ))
    assert_size_stride(primals_12, (64, 128), (128, 1))
    assert_size_stride(primals_13, (64, ), (1, ))
    assert_size_stride(primals_14, (64, 128), (128, 1))
    assert_size_stride(primals_15, (64, ), (1, ))
    assert_size_stride(primals_16, (64, 64), (64, 1))
    assert_size_stride(primals_17, (64, ), (1, ))
    assert_size_stride(primals_18, (64, 32, 4, 4), (512, 16, 4, 1))
    assert_size_stride(primals_19, (32, ), (1, ))
    assert_size_stride(primals_20, (32, 16, 4, 4), (256, 16, 4, 1))
    assert_size_stride(primals_21, (16, ), (1, ))
    assert_size_stride(primals_22, (16, 1, 5, 5), (25, 25, 5, 1))
    assert_size_stride(primals_23, (1, ), (1, ))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        # Topologically Sorted Source Nodes: [conv2d], Original ATen: [aten.convolution]
        buf0 = extern_kernels.convolution(primals_3, primals_1, stride=(4, 4), padding=(1, 1), dilation=(2, 2), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf0, (4, 8, 63, 63), (31752, 3969, 63, 1))
        buf1 = empty_strided_cuda((4, 8, 63, 63), (31752, 3969, 63, 1), torch.bool)
        buf2 = empty_strided_cuda((4, 8, 63, 63), (31752, 3969, 63, 1), torch.float32)
        # Topologically Sorted Source Nodes: [conv2d, x], Original ATen: [aten.convolution, aten.leaky_relu]
        stream0 = get_raw_stream(0)
        triton_poi_fused_convolution_leaky_relu_0.run(buf0, primals_2, buf1, buf2, 127008, grid=grid(127008), stream=stream0)
        del buf0
        del primals_2
        # Topologically Sorted Source Nodes: [conv2d_1], Original ATen: [aten.convolution]
        buf3 = extern_kernels.convolution(buf2, primals_4, stride=(3, 3), padding=(1, 1), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf3, (4, 16, 21, 21), (7056, 441, 21, 1))
        buf4 = empty_strided_cuda((4, 16, 21, 21), (7056, 441, 21, 1), torch.bool)
        buf5 = empty_strided_cuda((4, 16, 21, 21), (7056, 441, 21, 1), torch.float32)
        # Topologically Sorted Source Nodes: [conv2d_1, x_1], Original ATen: [aten.convolution, aten.leaky_relu]
        triton_poi_fused_convolution_leaky_relu_1.run(buf3, primals_5, buf4, buf5, 28224, grid=grid(28224), stream=stream0)
        del buf3
        del primals_5
        # Topologically Sorted Source Nodes: [conv2d_2], Original ATen: [aten.convolution]
        buf6 = extern_kernels.convolution(buf5, primals_6, stride=(3, 3), padding=(1, 1), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf6, (4, 32, 7, 7), (1568, 49, 7, 1))
        buf7 = empty_strided_cuda((4, 32, 7, 7), (1568, 49, 7, 1), torch.bool)
        buf8 = empty_strided_cuda((4, 32, 7, 7), (1568, 49, 7, 1), torch.float32)
        # Topologically Sorted Source Nodes: [conv2d_2, x_2], Original ATen: [aten.convolution, aten.leaky_relu]
        triton_poi_fused_convolution_leaky_relu_2.run(buf6, primals_7, buf7, buf8, 6272, grid=grid(6272), stream=stream0)
        del buf6
        del primals_7
        # Topologically Sorted Source Nodes: [conv2d_3], Original ATen: [aten.convolution]
        buf9 = extern_kernels.convolution(buf8, primals_8, stride=(2, 2), padding=(0, 0), dilation=(1, 1), transposed=False, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf9, (4, 64, 1, 1), (64, 1, 1, 1))
        buf10 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 1, 1), torch.bool)
        buf11 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 256, 256), torch.float32)
        # Topologically Sorted Source Nodes: [conv2d_3, x_3, adaptive_avg_pool2d], Original ATen: [aten.convolution, aten.leaky_relu, aten.mean]
        triton_poi_fused_convolution_leaky_relu_mean_3.run(buf9, primals_9, buf10, buf11, 256, grid=grid(256), stream=stream0)
        del primals_9
        buf12 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        # Topologically Sorted Source Nodes: [hidden], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_11, reinterpret_tensor(buf11, (4, 64), (64, 1), 0), reinterpret_tensor(primals_10, (64, 128), (1, 64), 0), alpha=1, beta=1, out=buf12)
        del primals_11
        buf13 = reinterpret_tensor(buf9, (4, 64), (64, 1), 0); del buf9  # reuse
        # Topologically Sorted Source Nodes: [mu], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_13, buf12, reinterpret_tensor(primals_12, (128, 64), (1, 128), 0), alpha=1, beta=1, out=buf13)
        del primals_13
        buf14 = empty_strided_cuda((4, 64), (64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [log_var], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_15, buf12, reinterpret_tensor(primals_14, (128, 64), (1, 128), 0), alpha=1, beta=1, out=buf14)
        del primals_15
        # Topologically Sorted Source Nodes: [eps], Original ATen: [aten.randn_like]
        buf15 = torch.ops.aten.randn.default([4, 64], dtype=torch.float32, device=device(type='cuda', index=0), pin_memory=False)
        buf16 = buf15
        del buf15
        buf17 = empty_strided_cuda((4, 64), (64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [mul, std, mul_1, sample], Original ATen: [aten.mul, aten.exp, aten.add]
        triton_poi_fused_add_exp_mul_4.run(buf13, buf16, buf14, buf17, 256, grid=grid(256), stream=stream0)
        buf18 = empty_strided_cuda((4, 64), (64, 1), torch.float32)
        # Topologically Sorted Source Nodes: [z], Original ATen: [aten.addmm]
        extern_kernels.addmm(primals_17, buf17, reinterpret_tensor(primals_16, (64, 64), (1, 64), 0), alpha=1, beta=1, out=buf18)
        del primals_17
        # Topologically Sorted Source Nodes: [conv_transpose2d], Original ATen: [aten.convolution]
        buf19 = extern_kernels.convolution(reinterpret_tensor(buf18, (4, 64, 1, 1), (64, 1, 1, 1), 0), primals_18, stride=(1, 1), padding=(0, 0), dilation=(1, 1), transposed=True, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf19, (4, 32, 4, 4), (512, 16, 4, 1))
        buf20 = empty_strided_cuda((4, 32, 4, 4), (512, 16, 4, 1), torch.bool)
        buf21 = empty_strided_cuda((4, 32, 4, 4), (512, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [conv_transpose2d, x_5], Original ATen: [aten.convolution, aten.leaky_relu]
        triton_poi_fused_convolution_leaky_relu_5.run(buf19, primals_19, buf20, buf21, 2048, grid=grid(2048), stream=stream0)
        del buf19
        del primals_19
        # Topologically Sorted Source Nodes: [conv_transpose2d_1], Original ATen: [aten.convolution]
        buf22 = extern_kernels.convolution(buf21, primals_20, stride=(2, 2), padding=(0, 0), dilation=(1, 1), transposed=True, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf22, (4, 16, 10, 10), (1600, 100, 10, 1))
        buf23 = empty_strided_cuda((4, 16, 10, 10), (1600, 100, 10, 1), torch.bool)
        buf24 = empty_strided_cuda((4, 16, 10, 10), (1600, 100, 10, 1), torch.float32)
        # Topologically Sorted Source Nodes: [conv_transpose2d_1, x_6], Original ATen: [aten.convolution, aten.leaky_relu]
        triton_poi_fused_convolution_leaky_relu_6.run(buf22, primals_21, buf23, buf24, 6400, grid=grid(6400), stream=stream0)
        del buf22
        del primals_21
        # Topologically Sorted Source Nodes: [conv_transpose2d_2], Original ATen: [aten.convolution]
        buf25 = extern_kernels.convolution(buf24, primals_22, stride=(2, 2), padding=(1, 1), dilation=(1, 1), transposed=True, output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf25, (4, 1, 21, 21), (441, 441, 21, 1))
        buf26 = buf25; del buf25  # reuse
        # Topologically Sorted Source Nodes: [conv_transpose2d_2, reconstruction], Original ATen: [aten.convolution, aten.sigmoid]
        triton_poi_fused_convolution_sigmoid_7.run(buf26, primals_23, 1764, grid=grid(1764), stream=stream0)
        del primals_23
    return (buf26, buf13, buf14, primals_1, primals_3, primals_4, primals_6, primals_8, primals_18, primals_20, primals_22, buf1, buf2, buf4, buf5, buf7, buf8, buf10, reinterpret_tensor(buf11, (4, 64), (64, 1), 0), buf12, buf14, buf16, buf17, reinterpret_tensor(buf18, (4, 64, 1, 1), (64, 1, 1, 1), 0), buf20, buf21, buf23, buf24, buf26, primals_16, primals_14, primals_12, primals_10, )


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((8, 3, 4, 4), (48, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((8, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((4, 3, 256, 256), (196608, 65536, 256, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((16, 8, 4, 4), (128, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((16, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((32, 16, 4, 4), (256, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((32, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((64, 32, 7, 7), (1568, 49, 7, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((128, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((128, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((64, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_13 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_14 = rand_strided((64, 128), (128, 1), device='cuda:0', dtype=torch.float32)
    primals_15 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_16 = rand_strided((64, 64), (64, 1), device='cuda:0', dtype=torch.float32)
    primals_17 = rand_strided((64, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_18 = rand_strided((64, 32, 4, 4), (512, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_19 = rand_strided((32, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_20 = rand_strided((32, 16, 4, 4), (256, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_21 = rand_strided((16, ), (1, ), device='cuda:0', dtype=torch.float32)
    primals_22 = rand_strided((16, 1, 5, 5), (25, 25, 5, 1), device='cuda:0', dtype=torch.float32)
    primals_23 = rand_strided((1, ), (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, primals_18, primals_19, primals_20, primals_21, primals_22, primals_23])
    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
from torch import nn
from torch.nn import functional as F


class Landsat2ViirsNet(nn.Module):

    def __init__(self, latent_dim=64, init_channels=8, kernel_size=4,
        image_in_channels=3, image_out_channels=1):
        super(Landsat2ViirsNet, self).__init__()
        self.enc1 = nn.Conv2d(in_channels=image_in_channels, out_channels=
            init_channels, kernel_size=kernel_size, stride=4, padding=1,
            dilation=2)
        self.enc2 = nn.Conv2d(in_channels=init_channels, out_channels=
            init_channels * 2, kernel_size=kernel_size, stride=3, padding=1)
        self.enc3 = nn.Conv2d(in_channels=init_channels * 2, out_channels=
            init_channels * 4, kernel_size=kernel_size, stride=3, padding=1)
        self.enc4 = nn.Conv2d(in_channels=init_channels * 4, out_channels=
            64, kernel_size=7, stride=2, padding=0)
        self.fc1 = nn.Linear(64, 128)
        self.fc_mu = nn.Linear(128, latent_dim)
        self.fc_log_var = nn.Linear(128, latent_dim)
        self.fc2 = nn.Linear(latent_dim, 64)
        self.dec1 = nn.ConvTranspose2d(in_channels=64, out_channels=
            init_channels * 4, kernel_size=kernel_size, stride=1, padding=0)
        self.dec2 = nn.ConvTranspose2d(in_channels=init_channels * 4,
            out_channels=init_channels * 2, kernel_size=kernel_size, stride
            =2, padding=0)
        self.dec3 = nn.ConvTranspose2d(in_channels=init_channels * 2,
            out_channels=image_out_channels, kernel_size=kernel_size + 1,
            stride=2, padding=1)

    def reparameterize(self, mu, log_var):
        """
        :param mu: mean from the encoder's latent space
        :param log_var: log variance from the encoder's latent space
        """
        std = torch.exp(0.5 * log_var)
        eps = torch.randn_like(std)
        sample = mu + eps * std
        return sample

    def forward(self, x):
        x = F.leaky_relu(self.enc1(x))
        x = F.leaky_relu(self.enc2(x))
        x = F.leaky_relu(self.enc3(x))
        x = F.leaky_relu(self.enc4(x))
        batch, _, _, _ = x.shape
        x = F.adaptive_avg_pool2d(x, 1).reshape(batch, -1)
        hidden = self.fc1(x)
        mu = self.fc_mu(hidden)
        log_var = self.fc_log_var(hidden)
        z = self.reparameterize(mu, log_var)
        z = self.fc2(z)
        z = z.view(-1, 64, 1, 1)
        x = F.leaky_relu(self.dec1(z))
        x = F.leaky_relu(self.dec2(x))
        reconstruction = torch.sigmoid(self.dec3(x))
        return reconstruction, mu, log_var


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


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

import torch
from torch import device
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
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_leaky_relu_0(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 127008
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 3969 % 8
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x3, tmp4, xmask)
    tl.store(out_ptr1 + x3, tmp7, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_1(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 28224
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 441 % 16
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x3, tmp4, xmask)
    tl.store(out_ptr1 + x3, tmp7, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_2(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 6272
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 49 % 32
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x3, tmp4, xmask)
    tl.store(out_ptr1 + x3, tmp7, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_mean_3(in_ptr0, in_ptr1,
    out_ptr0, out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tmp8 = 1.0
    tmp9 = tmp7 / tmp8
    tl.store(out_ptr0 + x2, tmp4, xmask)
    tl.store(out_ptr1 + x2, tmp9, xmask)


@triton.jit
def triton_poi_fused_add_exp_mul_4(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    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 = tl.load(in_ptr1 + x0, xmask)
    tmp2 = tl.load(in_ptr2 + x0, xmask)
    tmp3 = 0.5
    tmp4 = tmp2 * tmp3
    tmp5 = tl_math.exp(tmp4)
    tmp6 = tmp1 * tmp5
    tmp7 = tmp0 + tmp6
    tl.store(out_ptr0 + x0, tmp7, xmask)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_5(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 16 % 32
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x3, tmp4, None)
    tl.store(out_ptr1 + x3, tmp7, None)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_6(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 6400
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 100 % 16
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x3, tmp4, xmask)
    tl.store(out_ptr1 + x3, tmp7, xmask)


@triton.jit
def triton_poi_fused_convolution_sigmoid_7(in_out_ptr0, in_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 1764
    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 = tl.load(in_ptr0 + 0)
    tmp2 = tl.broadcast_to(tmp1, [XBLOCK])
    tmp3 = tmp0 + tmp2
    tmp4 = tl.sigmoid(tmp3)
    tl.store(in_out_ptr0 + x0, tmp4, 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,
        primals_18, primals_19, primals_20, primals_21, primals_22, primals_23
        ) = args
    args.clear()
    assert_size_stride(primals_1, (8, 3, 4, 4), (48, 16, 4, 1))
    assert_size_stride(primals_2, (8,), (1,))
    assert_size_stride(primals_3, (4, 3, 256, 256), (196608, 65536, 256, 1))
    assert_size_stride(primals_4, (16, 8, 4, 4), (128, 16, 4, 1))
    assert_size_stride(primals_5, (16,), (1,))
    assert_size_stride(primals_6, (32, 16, 4, 4), (256, 16, 4, 1))
    assert_size_stride(primals_7, (32,), (1,))
    assert_size_stride(primals_8, (64, 32, 7, 7), (1568, 49, 7, 1))
    assert_size_stride(primals_9, (64,), (1,))
    assert_size_stride(primals_10, (128, 64), (64, 1))
    assert_size_stride(primals_11, (128,), (1,))
    assert_size_stride(primals_12, (64, 128), (128, 1))
    assert_size_stride(primals_13, (64,), (1,))
    assert_size_stride(primals_14, (64, 128), (128, 1))
    assert_size_stride(primals_15, (64,), (1,))
    assert_size_stride(primals_16, (64, 64), (64, 1))
    assert_size_stride(primals_17, (64,), (1,))
    assert_size_stride(primals_18, (64, 32, 4, 4), (512, 16, 4, 1))
    assert_size_stride(primals_19, (32,), (1,))
    assert_size_stride(primals_20, (32, 16, 4, 4), (256, 16, 4, 1))
    assert_size_stride(primals_21, (16,), (1,))
    assert_size_stride(primals_22, (16, 1, 5, 5), (25, 25, 5, 1))
    assert_size_stride(primals_23, (1,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = extern_kernels.convolution(primals_3, primals_1, stride=(4, 
            4), padding=(1, 1), dilation=(2, 2), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf0, (4, 8, 63, 63), (31752, 3969, 63, 1))
        buf1 = empty_strided_cuda((4, 8, 63, 63), (31752, 3969, 63, 1),
            torch.bool)
        buf2 = empty_strided_cuda((4, 8, 63, 63), (31752, 3969, 63, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_convolution_leaky_relu_0[grid(127008)](buf0,
            primals_2, buf1, buf2, 127008, XBLOCK=1024, num_warps=4,
            num_stages=1)
        del buf0
        del primals_2
        buf3 = extern_kernels.convolution(buf2, primals_4, stride=(3, 3),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf3, (4, 16, 21, 21), (7056, 441, 21, 1))
        buf4 = empty_strided_cuda((4, 16, 21, 21), (7056, 441, 21, 1),
            torch.bool)
        buf5 = empty_strided_cuda((4, 16, 21, 21), (7056, 441, 21, 1),
            torch.float32)
        triton_poi_fused_convolution_leaky_relu_1[grid(28224)](buf3,
            primals_5, buf4, buf5, 28224, XBLOCK=256, num_warps=4, num_stages=1
            )
        del buf3
        del primals_5
        buf6 = extern_kernels.convolution(buf5, primals_6, stride=(3, 3),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf6, (4, 32, 7, 7), (1568, 49, 7, 1))
        buf7 = empty_strided_cuda((4, 32, 7, 7), (1568, 49, 7, 1), torch.bool)
        buf8 = empty_strided_cuda((4, 32, 7, 7), (1568, 49, 7, 1), torch.
            float32)
        triton_poi_fused_convolution_leaky_relu_2[grid(6272)](buf6,
            primals_7, buf7, buf8, 6272, XBLOCK=256, num_warps=4, num_stages=1)
        del buf6
        del primals_7
        buf9 = extern_kernels.convolution(buf8, primals_8, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf9, (4, 64, 1, 1), (64, 1, 1, 1))
        buf10 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 1, 1), torch.bool)
        buf11 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 256, 256), torch.
            float32)
        triton_poi_fused_convolution_leaky_relu_mean_3[grid(256)](buf9,
            primals_9, buf10, buf11, 256, XBLOCK=256, num_warps=4, num_stages=1
            )
        del primals_9
        buf12 = empty_strided_cuda((4, 128), (128, 1), torch.float32)
        extern_kernels.addmm(primals_11, reinterpret_tensor(buf11, (4, 64),
            (64, 1), 0), reinterpret_tensor(primals_10, (64, 128), (1, 64),
            0), alpha=1, beta=1, out=buf12)
        del primals_11
        buf13 = reinterpret_tensor(buf9, (4, 64), (64, 1), 0)
        del buf9
        extern_kernels.addmm(primals_13, buf12, reinterpret_tensor(
            primals_12, (128, 64), (1, 128), 0), alpha=1, beta=1, out=buf13)
        del primals_13
        buf14 = empty_strided_cuda((4, 64), (64, 1), torch.float32)
        extern_kernels.addmm(primals_15, buf12, reinterpret_tensor(
            primals_14, (128, 64), (1, 128), 0), alpha=1, beta=1, out=buf14)
        del primals_15
        buf15 = torch.ops.aten.randn.default([4, 64], dtype=torch.float32,
            device=device(type='cuda', index=0), pin_memory=False)
        buf16 = buf15
        del buf15
        buf17 = empty_strided_cuda((4, 64), (64, 1), torch.float32)
        triton_poi_fused_add_exp_mul_4[grid(256)](buf13, buf16, buf14,
            buf17, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf18 = empty_strided_cuda((4, 64), (64, 1), torch.float32)
        extern_kernels.addmm(primals_17, buf17, reinterpret_tensor(
            primals_16, (64, 64), (1, 64), 0), alpha=1, beta=1, out=buf18)
        del primals_17
        buf19 = extern_kernels.convolution(reinterpret_tensor(buf18, (4, 64,
            1, 1), (64, 1, 1, 1), 0), primals_18, stride=(1, 1), padding=(0,
            0), dilation=(1, 1), transposed=True, output_padding=(0, 0),
            groups=1, bias=None)
        assert_size_stride(buf19, (4, 32, 4, 4), (512, 16, 4, 1))
        buf20 = empty_strided_cuda((4, 32, 4, 4), (512, 16, 4, 1), torch.bool)
        buf21 = empty_strided_cuda((4, 32, 4, 4), (512, 16, 4, 1), torch.
            float32)
        triton_poi_fused_convolution_leaky_relu_5[grid(2048)](buf19,
            primals_19, buf20, buf21, 2048, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf19
        del primals_19
        buf22 = extern_kernels.convolution(buf21, primals_20, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=True,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf22, (4, 16, 10, 10), (1600, 100, 10, 1))
        buf23 = empty_strided_cuda((4, 16, 10, 10), (1600, 100, 10, 1),
            torch.bool)
        buf24 = empty_strided_cuda((4, 16, 10, 10), (1600, 100, 10, 1),
            torch.float32)
        triton_poi_fused_convolution_leaky_relu_6[grid(6400)](buf22,
            primals_21, buf23, buf24, 6400, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf22
        del primals_21
        buf25 = extern_kernels.convolution(buf24, primals_22, stride=(2, 2),
            padding=(1, 1), dilation=(1, 1), transposed=True,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf25, (4, 1, 21, 21), (441, 441, 21, 1))
        buf26 = buf25
        del buf25
        triton_poi_fused_convolution_sigmoid_7[grid(1764)](buf26,
            primals_23, 1764, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_23
    return (buf26, buf13, buf14, primals_1, primals_3, primals_4, primals_6,
        primals_8, primals_18, primals_20, primals_22, buf1, buf2, buf4,
        buf5, buf7, buf8, buf10, reinterpret_tensor(buf11, (4, 64), (64, 1),
        0), buf12, buf14, buf16, buf17, reinterpret_tensor(buf18, (4, 64, 1,
        1), (64, 1, 1, 1), 0), buf20, buf21, buf23, buf24, buf26,
        primals_16, primals_14, primals_12, primals_10)


class Landsat2ViirsNetNew(nn.Module):

    def __init__(self, latent_dim=64, init_channels=8, kernel_size=4,
        image_in_channels=3, image_out_channels=1):
        super(Landsat2ViirsNetNew, self).__init__()
        self.enc1 = nn.Conv2d(in_channels=image_in_channels, out_channels=
            init_channels, kernel_size=kernel_size, stride=4, padding=1,
            dilation=2)
        self.enc2 = nn.Conv2d(in_channels=init_channels, out_channels=
            init_channels * 2, kernel_size=kernel_size, stride=3, padding=1)
        self.enc3 = nn.Conv2d(in_channels=init_channels * 2, out_channels=
            init_channels * 4, kernel_size=kernel_size, stride=3, padding=1)
        self.enc4 = nn.Conv2d(in_channels=init_channels * 4, out_channels=
            64, kernel_size=7, stride=2, padding=0)
        self.fc1 = nn.Linear(64, 128)
        self.fc_mu = nn.Linear(128, latent_dim)
        self.fc_log_var = nn.Linear(128, latent_dim)
        self.fc2 = nn.Linear(latent_dim, 64)
        self.dec1 = nn.ConvTranspose2d(in_channels=64, out_channels=
            init_channels * 4, kernel_size=kernel_size, stride=1, padding=0)
        self.dec2 = nn.ConvTranspose2d(in_channels=init_channels * 4,
            out_channels=init_channels * 2, kernel_size=kernel_size, stride
            =2, padding=0)
        self.dec3 = nn.ConvTranspose2d(in_channels=init_channels * 2,
            out_channels=image_out_channels, kernel_size=kernel_size + 1,
            stride=2, padding=1)

    def reparameterize(self, mu, log_var):
        """
        :param mu: mean from the encoder's latent space
        :param log_var: log variance from the encoder's latent space
        """
        std = torch.exp(0.5 * log_var)
        eps = torch.randn_like(std)
        sample = mu + eps * std
        return sample

    def forward(self, input_0):
        primals_1 = self.enc1.weight
        primals_2 = self.enc1.bias
        primals_4 = self.enc2.weight
        primals_5 = self.enc2.bias
        primals_6 = self.enc3.weight
        primals_7 = self.enc3.bias
        primals_8 = self.enc4.weight
        primals_9 = self.enc4.bias
        primals_10 = self.fc1.weight
        primals_11 = self.fc1.bias
        primals_12 = self.fc_mu.weight
        primals_13 = self.fc_mu.bias
        primals_14 = self.fc_log_var.weight
        primals_15 = self.fc_log_var.bias
        primals_16 = self.fc2.weight
        primals_17 = self.fc2.bias
        primals_18 = self.dec1.weight
        primals_19 = self.dec1.bias
        primals_20 = self.dec2.weight
        primals_21 = self.dec2.bias
        primals_22 = self.dec3.weight
        primals_23 = self.dec3.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, primals_18, primals_19,
            primals_20, primals_21, primals_22, primals_23])
        return output[0], output[1], output[2]
