import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.functional as F
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_rsub_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 = 1.0
    tmp2 = tmp1 - tmp0
    tl.store(out_ptr0 + x0, tmp2, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_leaky_relu_1(in_ptr0,
    out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 1024 * x0), None)
    tmp1 = tl.broadcast_to(tmp0, [RBLOCK])
    tmp3 = tl.broadcast_to(tmp1, [RBLOCK])
    tmp5 = triton_helpers.promote_to_tensor(tl.sum(tmp3, 0))
    tmp6 = tl.full([1], 1024, tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 / tmp7
    tmp9 = tmp1 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp13 = triton_helpers.promote_to_tensor(tl.sum(tmp11, 0))
    tmp14 = tmp0 - tmp8
    tmp15 = 1024.0
    tmp16 = tmp13 / tmp15
    tmp17 = 1e-05
    tmp18 = tmp16 + tmp17
    tmp19 = libdevice.rsqrt(tmp18)
    tmp20 = tmp14 * tmp19
    tmp21 = 0.0
    tmp22 = tmp20 > tmp21
    tmp23 = 0.02
    tmp24 = tmp20 * tmp23
    tmp25 = tl.where(tmp22, tmp20, tmp24)
    tl.store(out_ptr2 + (r1 + 1024 * x0), tmp25, None)
    tl.store(out_ptr3 + x0, tmp19, None)
    tl.store(out_ptr0 + x0, tmp8, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_leaky_relu_2(in_ptr0,
    in_ptr1, out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 1024 * x0), None)
    tmp21 = tl.load(in_ptr1 + (r1 + 1024 * x0), None)
    tmp1 = tl.broadcast_to(tmp0, [RBLOCK])
    tmp3 = tl.broadcast_to(tmp1, [RBLOCK])
    tmp5 = triton_helpers.promote_to_tensor(tl.sum(tmp3, 0))
    tmp6 = tl.full([1], 1024, tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 / tmp7
    tmp9 = tmp1 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp13 = triton_helpers.promote_to_tensor(tl.sum(tmp11, 0))
    tmp14 = tmp0 - tmp8
    tmp15 = 1024.0
    tmp16 = tmp13 / tmp15
    tmp17 = 1e-05
    tmp18 = tmp16 + tmp17
    tmp19 = libdevice.rsqrt(tmp18)
    tmp20 = tmp14 * tmp19
    tmp22 = tmp20 + tmp21
    tmp23 = 0.0
    tmp24 = tmp22 > tmp23
    tmp25 = 0.02
    tmp26 = tmp22 * tmp25
    tmp27 = tl.where(tmp24, tmp22, tmp26)
    tl.store(out_ptr2 + (r1 + 1024 * x0), tmp27, None)
    tl.store(out_ptr3 + x0, tmp19, None)
    tl.store(out_ptr0 + x0, tmp8, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_leaky_relu_3(in_ptr0,
    out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 256 * x0), None)
    tmp1 = tl.broadcast_to(tmp0, [RBLOCK])
    tmp3 = tl.broadcast_to(tmp1, [RBLOCK])
    tmp5 = triton_helpers.promote_to_tensor(tl.sum(tmp3, 0))
    tmp6 = tl.full([1], 256, tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 / tmp7
    tmp9 = tmp1 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp13 = triton_helpers.promote_to_tensor(tl.sum(tmp11, 0))
    tmp14 = tmp0 - tmp8
    tmp15 = 256.0
    tmp16 = tmp13 / tmp15
    tmp17 = 1e-05
    tmp18 = tmp16 + tmp17
    tmp19 = libdevice.rsqrt(tmp18)
    tmp20 = tmp14 * tmp19
    tmp21 = 0.0
    tmp22 = tmp20 > tmp21
    tmp23 = 0.02
    tmp24 = tmp20 * tmp23
    tmp25 = tl.where(tmp22, tmp20, tmp24)
    tl.store(out_ptr2 + (r1 + 256 * x0), tmp25, None)
    tl.store(out_ptr3 + x0, tmp19, None)
    tl.store(out_ptr0 + x0, tmp8, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_leaky_relu_4(in_out_ptr0,
    in_ptr0, in_ptr1, out_ptr0, out_ptr2, out_ptr4, out_ptr5, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 256 * x0), None)
    tmp14 = tl.load(in_ptr1 + (r1 + 256 * x0), None)
    tmp1 = tl.broadcast_to(tmp0, [RBLOCK])
    tmp3 = tl.broadcast_to(tmp1, [RBLOCK])
    tmp5 = triton_helpers.promote_to_tensor(tl.sum(tmp3, 0))
    tmp6 = tl.full([1], 256, tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 / tmp7
    tmp9 = tmp1 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp13 = triton_helpers.promote_to_tensor(tl.sum(tmp11, 0))
    tmp15 = tl.broadcast_to(tmp14, [RBLOCK])
    tmp17 = tl.broadcast_to(tmp15, [RBLOCK])
    tmp19 = triton_helpers.promote_to_tensor(tl.sum(tmp17, 0))
    tmp20 = tmp19 / tmp7
    tmp21 = tmp15 - tmp20
    tmp22 = tmp21 * tmp21
    tmp23 = tl.broadcast_to(tmp22, [RBLOCK])
    tmp25 = triton_helpers.promote_to_tensor(tl.sum(tmp23, 0))
    tmp26 = tmp0 - tmp8
    tmp27 = 256.0
    tmp28 = tmp13 / tmp27
    tmp29 = 1e-05
    tmp30 = tmp28 + tmp29
    tmp31 = libdevice.rsqrt(tmp30)
    tmp32 = tmp26 * tmp31
    tmp33 = tmp14 - tmp20
    tmp34 = tmp25 / tmp27
    tmp35 = tmp34 + tmp29
    tmp36 = libdevice.rsqrt(tmp35)
    tmp37 = tmp33 * tmp36
    tmp38 = tmp32 + tmp37
    tmp39 = 0.0
    tmp40 = tmp38 > tmp39
    tmp41 = 0.02
    tmp42 = tmp38 * tmp41
    tmp43 = tl.where(tmp40, tmp38, tmp42)
    tl.store(in_out_ptr0 + (r1 + 256 * x0), tmp43, None)
    tl.store(out_ptr4 + x0, tmp31, None)
    tl.store(out_ptr5 + x0, tmp36, None)
    tl.store(out_ptr0 + x0, tmp8, None)
    tl.store(out_ptr2 + x0, tmp20, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_leaky_relu_5(in_ptr0,
    in_ptr1, out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 256 * x0), None)
    tmp21 = tl.load(in_ptr1 + (r1 + 256 * x0), None)
    tmp1 = tl.broadcast_to(tmp0, [RBLOCK])
    tmp3 = tl.broadcast_to(tmp1, [RBLOCK])
    tmp5 = triton_helpers.promote_to_tensor(tl.sum(tmp3, 0))
    tmp6 = tl.full([1], 256, tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 / tmp7
    tmp9 = tmp1 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp13 = triton_helpers.promote_to_tensor(tl.sum(tmp11, 0))
    tmp14 = tmp0 - tmp8
    tmp15 = 256.0
    tmp16 = tmp13 / tmp15
    tmp17 = 1e-05
    tmp18 = tmp16 + tmp17
    tmp19 = libdevice.rsqrt(tmp18)
    tmp20 = tmp14 * tmp19
    tmp22 = tmp20 + tmp21
    tmp23 = 0.0
    tmp24 = tmp22 > tmp23
    tmp25 = 0.02
    tmp26 = tmp22 * tmp25
    tmp27 = tl.where(tmp24, tmp22, tmp26)
    tl.store(out_ptr2 + (r1 + 256 * x0), tmp27, None)
    tl.store(out_ptr3 + x0, tmp19, None)
    tl.store(out_ptr0 + x0, tmp8, None)


@triton.jit
def triton_per_fused__native_batch_norm_legit_leaky_relu_6(in_ptr0,
    out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    RBLOCK: tl.constexpr = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 64 * x0), xmask, other=0.0)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp1, 0)
    tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
    tmp6 = tl.where(xmask, tmp4, 0)
    tmp7 = tl.sum(tmp6, 1)[:, None]
    tmp8 = tl.full([XBLOCK, 1], 64, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp1 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [XBLOCK, RBLOCK])
    tmp15 = tl.where(xmask, tmp13, 0)
    tmp16 = tl.sum(tmp15, 1)[:, None]
    tmp17 = tmp0 - tmp10
    tmp18 = 64.0
    tmp19 = tmp16 / tmp18
    tmp20 = 1e-05
    tmp21 = tmp19 + tmp20
    tmp22 = libdevice.rsqrt(tmp21)
    tmp23 = tmp17 * tmp22
    tmp24 = 0.0
    tmp25 = tmp23 > tmp24
    tmp26 = 0.02
    tmp27 = tmp23 * tmp26
    tmp28 = tl.where(tmp25, tmp23, tmp27)
    tl.store(out_ptr2 + (r1 + 64 * x0), tmp28, xmask)
    tl.store(out_ptr3 + x0, tmp22, xmask)
    tl.store(out_ptr0 + x0, tmp10, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_leaky_relu_7(in_out_ptr0,
    in_ptr0, in_ptr1, out_ptr0, out_ptr2, out_ptr4, out_ptr5, xnumel,
    rnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    RBLOCK: tl.constexpr = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 64 * x0), xmask, other=0.0)
    tmp17 = tl.load(in_ptr1 + (r1 + 64 * x0), xmask, other=0.0)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp1, 0)
    tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
    tmp6 = tl.where(xmask, tmp4, 0)
    tmp7 = tl.sum(tmp6, 1)[:, None]
    tmp8 = tl.full([XBLOCK, 1], 64, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp1 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [XBLOCK, RBLOCK])
    tmp15 = tl.where(xmask, tmp13, 0)
    tmp16 = tl.sum(tmp15, 1)[:, None]
    tmp18 = tl.broadcast_to(tmp17, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp18, 0)
    tmp21 = tl.broadcast_to(tmp18, [XBLOCK, RBLOCK])
    tmp23 = tl.where(xmask, tmp21, 0)
    tmp24 = tl.sum(tmp23, 1)[:, None]
    tmp25 = tmp24 / tmp9
    tmp26 = tmp18 - tmp25
    tmp27 = tmp26 * tmp26
    tmp28 = tl.broadcast_to(tmp27, [XBLOCK, RBLOCK])
    tmp30 = tl.where(xmask, tmp28, 0)
    tmp31 = tl.sum(tmp30, 1)[:, None]
    tmp32 = tmp0 - tmp10
    tmp33 = 64.0
    tmp34 = tmp16 / tmp33
    tmp35 = 1e-05
    tmp36 = tmp34 + tmp35
    tmp37 = libdevice.rsqrt(tmp36)
    tmp38 = tmp32 * tmp37
    tmp39 = tmp17 - tmp25
    tmp40 = tmp31 / tmp33
    tmp41 = tmp40 + tmp35
    tmp42 = libdevice.rsqrt(tmp41)
    tmp43 = tmp39 * tmp42
    tmp44 = tmp38 + tmp43
    tmp45 = 0.0
    tmp46 = tmp44 > tmp45
    tmp47 = 0.02
    tmp48 = tmp44 * tmp47
    tmp49 = tl.where(tmp46, tmp44, tmp48)
    tl.store(in_out_ptr0 + (r1 + 64 * x0), tmp49, xmask)
    tl.store(out_ptr4 + x0, tmp37, xmask)
    tl.store(out_ptr5 + x0, tmp42, xmask)
    tl.store(out_ptr0 + x0, tmp10, xmask)
    tl.store(out_ptr2 + x0, tmp25, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_add_leaky_relu_8(in_ptr0,
    in_ptr1, out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 64
    RBLOCK: tl.constexpr = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 64 * x0), xmask, other=0.0)
    tmp24 = tl.load(in_ptr1 + (r1 + 64 * x0), xmask, other=0.0)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp1, 0)
    tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
    tmp6 = tl.where(xmask, tmp4, 0)
    tmp7 = tl.sum(tmp6, 1)[:, None]
    tmp8 = tl.full([XBLOCK, 1], 64, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp1 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [XBLOCK, RBLOCK])
    tmp15 = tl.where(xmask, tmp13, 0)
    tmp16 = tl.sum(tmp15, 1)[:, None]
    tmp17 = tmp0 - tmp10
    tmp18 = 64.0
    tmp19 = tmp16 / tmp18
    tmp20 = 1e-05
    tmp21 = tmp19 + tmp20
    tmp22 = libdevice.rsqrt(tmp21)
    tmp23 = tmp17 * tmp22
    tmp25 = tmp23 + tmp24
    tmp26 = 0.0
    tmp27 = tmp25 > tmp26
    tmp28 = 0.02
    tmp29 = tmp25 * tmp28
    tmp30 = tl.where(tmp27, tmp25, tmp29)
    tl.store(out_ptr2 + (r1 + 64 * x0), tmp30, xmask)
    tl.store(out_ptr3 + x0, tmp22, xmask)
    tl.store(out_ptr0 + x0, tmp10, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_leaky_relu_9(in_ptr0,
    out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    RBLOCK: tl.constexpr = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 16 * x0), xmask, other=0.0)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp1, 0)
    tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
    tmp6 = tl.where(xmask, tmp4, 0)
    tmp7 = tl.sum(tmp6, 1)[:, None]
    tmp8 = tl.full([XBLOCK, 1], 16, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp1 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [XBLOCK, RBLOCK])
    tmp15 = tl.where(xmask, tmp13, 0)
    tmp16 = tl.sum(tmp15, 1)[:, None]
    tmp17 = tmp0 - tmp10
    tmp18 = 16.0
    tmp19 = tmp16 / tmp18
    tmp20 = 1e-05
    tmp21 = tmp19 + tmp20
    tmp22 = libdevice.rsqrt(tmp21)
    tmp23 = tmp17 * tmp22
    tmp24 = 0.0
    tmp25 = tmp23 > tmp24
    tmp26 = 0.02
    tmp27 = tmp23 * tmp26
    tmp28 = tl.where(tmp25, tmp23, tmp27)
    tl.store(out_ptr2 + (r1 + 16 * x0), tmp28, xmask)
    tl.store(out_ptr3 + x0, tmp22, xmask)
    tl.store(out_ptr0 + x0, tmp10, xmask)


@triton.jit
def triton_poi_fused_convolution_10(in_out_ptr0, in_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 4
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x2, tmp2, 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) = args
    args.clear()
    assert_size_stride(primals_1, (4, 1, 64, 64), (4096, 4096, 64, 1))
    assert_size_stride(primals_2, (4, 1, 7, 7), (49, 49, 7, 1))
    assert_size_stride(primals_3, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_4, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_5, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_6, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_7, (8, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_8, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_9, (8, 4, 1, 1), (4, 1, 1, 1))
    assert_size_stride(primals_10, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_11, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_12, (16, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_13, (16, 16, 3, 3), (144, 9, 3, 1))
    assert_size_stride(primals_14, (16, 8, 1, 1), (8, 1, 1, 1))
    assert_size_stride(primals_15, (16, 16, 3, 3), (144, 9, 3, 1))
    assert_size_stride(primals_16, (16, 16, 3, 3), (144, 9, 3, 1))
    assert_size_stride(primals_17, (16, 16, 4, 4), (256, 16, 4, 1))
    assert_size_stride(primals_18, (4, 16, 4, 4), (256, 16, 4, 1))
    assert_size_stride(primals_19, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 1, 64, 64), (4096, 4096, 64, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_rsub_0[grid(16384)](primals_1, buf0, 16384, XBLOCK
            =128, num_warps=4, num_stages=1)
        del primals_1
        buf1 = extern_kernels.convolution(buf0, primals_2, stride=(2, 2),
            padding=(3, 3), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf1, (4, 4, 32, 32), (4096, 1024, 32, 1))
        buf2 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.float32
            )
        buf6 = empty_strided_cuda((4, 4, 32, 32), (4096, 1024, 32, 1),
            torch.float32)
        buf5 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.float32
            )
        triton_per_fused__native_batch_norm_legit_leaky_relu_1[grid(16)](buf1,
            buf2, buf6, buf5, 16, 1024, num_warps=8, num_stages=1)
        buf7 = extern_kernels.convolution(buf6, primals_3, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf7, (4, 4, 32, 32), (4096, 1024, 32, 1))
        buf8 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.float32
            )
        buf12 = empty_strided_cuda((4, 4, 32, 32), (4096, 1024, 32, 1),
            torch.float32)
        buf11 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_1[grid(16)](buf7,
            buf8, buf12, buf11, 16, 1024, num_warps=8, num_stages=1)
        buf13 = extern_kernels.convolution(buf12, primals_4, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf13, (4, 4, 32, 32), (4096, 1024, 32, 1))
        buf14 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf18 = empty_strided_cuda((4, 4, 32, 32), (4096, 1024, 32, 1),
            torch.float32)
        buf17 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_add_leaky_relu_2[grid(16)](
            buf13, buf6, buf14, buf18, buf17, 16, 1024, num_warps=8,
            num_stages=1)
        buf19 = extern_kernels.convolution(buf18, primals_5, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf19, (4, 4, 32, 32), (4096, 1024, 32, 1))
        buf20 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf24 = empty_strided_cuda((4, 4, 32, 32), (4096, 1024, 32, 1),
            torch.float32)
        buf23 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_1[grid(16)](buf19,
            buf20, buf24, buf23, 16, 1024, num_warps=8, num_stages=1)
        buf25 = extern_kernels.convolution(buf24, primals_6, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf25, (4, 4, 32, 32), (4096, 1024, 32, 1))
        buf26 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf30 = empty_strided_cuda((4, 4, 32, 32), (4096, 1024, 32, 1),
            torch.float32)
        buf29 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_add_leaky_relu_2[grid(16)](
            buf25, buf18, buf26, buf30, buf29, 16, 1024, num_warps=8,
            num_stages=1)
        buf31 = extern_kernels.convolution(buf30, primals_7, stride=(2, 2),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf31, (4, 8, 16, 16), (2048, 256, 16, 1))
        buf32 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        buf36 = empty_strided_cuda((4, 8, 16, 16), (2048, 256, 16, 1),
            torch.float32)
        buf35 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_3[grid(32)](buf31,
            buf32, buf36, buf35, 32, 256, num_warps=2, num_stages=1)
        buf37 = extern_kernels.convolution(buf36, primals_8, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf37, (4, 8, 16, 16), (2048, 256, 16, 1))
        buf42 = extern_kernels.convolution(buf30, primals_9, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf42, (4, 8, 16, 16), (2048, 256, 16, 1))
        buf38 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        buf43 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        buf47 = empty_strided_cuda((4, 8, 16, 16), (2048, 256, 16, 1),
            torch.float32)
        buf48 = buf47
        del buf47
        buf41 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        buf46 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_add_leaky_relu_4[grid(32)](
            buf48, buf37, buf42, buf38, buf43, buf41, buf46, 32, 256,
            num_warps=2, num_stages=1)
        buf49 = extern_kernels.convolution(buf48, primals_10, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf49, (4, 8, 16, 16), (2048, 256, 16, 1))
        buf50 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        buf54 = empty_strided_cuda((4, 8, 16, 16), (2048, 256, 16, 1),
            torch.float32)
        buf53 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_3[grid(32)](buf49,
            buf50, buf54, buf53, 32, 256, num_warps=2, num_stages=1)
        buf55 = extern_kernels.convolution(buf54, primals_11, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf55, (4, 8, 16, 16), (2048, 256, 16, 1))
        buf56 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        buf60 = empty_strided_cuda((4, 8, 16, 16), (2048, 256, 16, 1),
            torch.float32)
        buf59 = empty_strided_cuda((1, 32, 1, 1), (32, 1, 32, 32), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_add_leaky_relu_5[grid(32)](
            buf55, buf48, buf56, buf60, buf59, 32, 256, num_warps=2,
            num_stages=1)
        buf61 = extern_kernels.convolution(buf60, primals_12, stride=(2, 2),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf61, (4, 16, 8, 8), (1024, 64, 8, 1))
        buf62 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf66 = empty_strided_cuda((4, 16, 8, 8), (1024, 64, 8, 1), torch.
            float32)
        buf65 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_6[grid(64)](buf61,
            buf62, buf66, buf65, 64, 64, XBLOCK=32, num_warps=8, num_stages=1)
        buf67 = extern_kernels.convolution(buf66, primals_13, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf67, (4, 16, 8, 8), (1024, 64, 8, 1))
        buf72 = extern_kernels.convolution(buf60, primals_14, stride=(2, 2),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf72, (4, 16, 8, 8), (1024, 64, 8, 1))
        buf68 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf73 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf77 = empty_strided_cuda((4, 16, 8, 8), (1024, 64, 8, 1), torch.
            float32)
        buf78 = buf77
        del buf77
        buf71 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf76 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_add_leaky_relu_7[grid(64)](
            buf78, buf67, buf72, buf68, buf73, buf71, buf76, 64, 64, XBLOCK
            =8, num_warps=4, num_stages=1)
        buf79 = extern_kernels.convolution(buf78, primals_15, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf79, (4, 16, 8, 8), (1024, 64, 8, 1))
        buf80 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf84 = empty_strided_cuda((4, 16, 8, 8), (1024, 64, 8, 1), torch.
            float32)
        buf83 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_6[grid(64)](buf79,
            buf80, buf84, buf83, 64, 64, XBLOCK=32, num_warps=8, num_stages=1)
        buf85 = extern_kernels.convolution(buf84, primals_16, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf85, (4, 16, 8, 8), (1024, 64, 8, 1))
        buf86 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf90 = empty_strided_cuda((4, 16, 8, 8), (1024, 64, 8, 1), torch.
            float32)
        buf89 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_add_leaky_relu_8[grid(64)](
            buf85, buf78, buf86, buf90, buf89, 64, 64, XBLOCK=32, num_warps
            =8, num_stages=1)
        buf91 = extern_kernels.convolution(buf90, primals_17, stride=(2, 2),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf91, (4, 16, 4, 4), (256, 16, 4, 1))
        buf92 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        buf96 = empty_strided_cuda((4, 16, 4, 4), (256, 16, 4, 1), torch.
            float32)
        buf95 = empty_strided_cuda((1, 64, 1, 1), (64, 1, 64, 64), torch.
            float32)
        triton_per_fused__native_batch_norm_legit_leaky_relu_9[grid(64)](buf91,
            buf92, buf96, buf95, 64, 16, XBLOCK=8, num_warps=2, num_stages=1)
        buf97 = extern_kernels.convolution(buf96, primals_18, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf97, (4, 4, 1, 1), (4, 1, 1, 1))
        buf98 = reinterpret_tensor(buf97, (4, 4, 1, 1), (4, 1, 16, 16), 0)
        del buf97
        triton_poi_fused_convolution_10[grid(16)](buf98, primals_19, 16,
            XBLOCK=16, num_warps=1, num_stages=1)
        del primals_19
    return (reinterpret_tensor(buf98, (16,), (1,), 0), 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, buf0, buf1,
        reinterpret_tensor(buf5, (16,), (1,), 0), buf6, buf7,
        reinterpret_tensor(buf11, (16,), (1,), 0), buf12, buf13,
        reinterpret_tensor(buf17, (16,), (1,), 0), buf18, buf19,
        reinterpret_tensor(buf23, (16,), (1,), 0), buf24, buf25,
        reinterpret_tensor(buf29, (16,), (1,), 0), buf30, buf31,
        reinterpret_tensor(buf35, (32,), (1,), 0), buf36, buf37,
        reinterpret_tensor(buf41, (32,), (1,), 0), buf42,
        reinterpret_tensor(buf46, (32,), (1,), 0), buf48, buf49,
        reinterpret_tensor(buf53, (32,), (1,), 0), buf54, buf55,
        reinterpret_tensor(buf59, (32,), (1,), 0), buf60, buf61,
        reinterpret_tensor(buf65, (64,), (1,), 0), buf66, buf67,
        reinterpret_tensor(buf71, (64,), (1,), 0), buf72,
        reinterpret_tensor(buf76, (64,), (1,), 0), buf78, buf79,
        reinterpret_tensor(buf83, (64,), (1,), 0), buf84, buf85,
        reinterpret_tensor(buf89, (64,), (1,), 0), buf90, buf91,
        reinterpret_tensor(buf95, (64,), (1,), 0), buf96,
        reinterpret_tensor(buf92, (1, 64, 1, 1), (64, 1, 1, 1), 0),
        reinterpret_tensor(buf86, (1, 64, 1, 1), (64, 1, 1, 1), 0),
        reinterpret_tensor(buf80, (1, 64, 1, 1), (64, 1, 1, 1), 0),
        reinterpret_tensor(buf73, (1, 64, 1, 1), (64, 1, 1, 1), 0),
        reinterpret_tensor(buf68, (1, 64, 1, 1), (64, 1, 1, 1), 0),
        reinterpret_tensor(buf62, (1, 64, 1, 1), (64, 1, 1, 1), 0),
        reinterpret_tensor(buf56, (1, 32, 1, 1), (32, 1, 1, 1), 0),
        reinterpret_tensor(buf50, (1, 32, 1, 1), (32, 1, 1, 1), 0),
        reinterpret_tensor(buf43, (1, 32, 1, 1), (32, 1, 1, 1), 0),
        reinterpret_tensor(buf38, (1, 32, 1, 1), (32, 1, 1, 1), 0),
        reinterpret_tensor(buf32, (1, 32, 1, 1), (32, 1, 1, 1), 0),
        reinterpret_tensor(buf26, (1, 16, 1, 1), (16, 1, 1, 1), 0),
        reinterpret_tensor(buf20, (1, 16, 1, 1), (16, 1, 1, 1), 0),
        reinterpret_tensor(buf14, (1, 16, 1, 1), (16, 1, 1, 1), 0),
        reinterpret_tensor(buf8, (1, 16, 1, 1), (16, 1, 1, 1), 0),
        reinterpret_tensor(buf2, (1, 16, 1, 1), (16, 1, 1, 1), 0))


class resnet_block(nn.Module):

    def __init__(self, dim_in, dim_out):
        super(resnet_block, self).__init__()
        self.dim_in = dim_in
        self.dim_out = dim_out
        if self.dim_in == self.dim_out:
            self.conv_1 = nn.Conv2d(self.dim_in, self.dim_out, 3, stride=1,
                padding=1, bias=False)
            self.bn_1 = nn.InstanceNorm2d(self.dim_out)
            self.conv_2 = nn.Conv2d(self.dim_out, self.dim_out, 3, stride=1,
                padding=1, bias=False)
            self.bn_2 = nn.InstanceNorm2d(self.dim_out)
        else:
            self.conv_1 = nn.Conv2d(self.dim_in, self.dim_out, 3, stride=2,
                padding=1, bias=False)
            self.bn_1 = nn.InstanceNorm2d(self.dim_out)
            self.conv_2 = nn.Conv2d(self.dim_out, self.dim_out, 3, stride=1,
                padding=1, bias=False)
            self.bn_2 = nn.InstanceNorm2d(self.dim_out)
            self.conv_s = nn.Conv2d(self.dim_in, self.dim_out, 1, stride=2,
                padding=0, bias=False)
            self.bn_s = nn.InstanceNorm2d(self.dim_out)

    def forward(self, input):
        if self.dim_in == self.dim_out:
            output = self.bn_1(self.conv_1(input))
            output = F.leaky_relu(output, negative_slope=0.02, inplace=True)
            output = self.bn_2(self.conv_2(output))
            output = output + input
            output = F.leaky_relu(output, negative_slope=0.02, inplace=True)
        else:
            output = self.bn_1(self.conv_1(input))
            output = F.leaky_relu(output, negative_slope=0.02, inplace=True)
            output = self.bn_2(self.conv_2(output))
            input_ = self.bn_s(self.conv_s(input))
            output = output + input_
            output = F.leaky_relu(output, negative_slope=0.02, inplace=True)
        return output


class img_encoderNew(nn.Module):

    def __init__(self, img_ef_dim, z_dim):
        super(img_encoderNew, self).__init__()
        self.img_ef_dim = img_ef_dim
        self.z_dim = z_dim
        self.conv_0 = nn.Conv2d(1, self.img_ef_dim, 7, stride=2, padding=3,
            bias=False)
        self.bn_0 = nn.InstanceNorm2d(self.img_ef_dim)
        self.res_1 = resnet_block(self.img_ef_dim, self.img_ef_dim)
        self.res_2 = resnet_block(self.img_ef_dim, self.img_ef_dim)
        self.res_3 = resnet_block(self.img_ef_dim, self.img_ef_dim * 2)
        self.res_4 = resnet_block(self.img_ef_dim * 2, self.img_ef_dim * 2)
        self.res_5 = resnet_block(self.img_ef_dim * 2, self.img_ef_dim * 4)
        self.res_6 = resnet_block(self.img_ef_dim * 4, self.img_ef_dim * 4)
        self.conv_9 = nn.Conv2d(self.img_ef_dim * 4, self.img_ef_dim * 4, 4,
            stride=2, padding=1, bias=False)
        self.bn_9 = nn.InstanceNorm2d(self.img_ef_dim * 4)
        self.conv_10 = nn.Conv2d(self.img_ef_dim * 4, self.z_dim, 4, stride
            =1, padding=0, bias=True)

    def forward(self, input_0):
        primals_2 = self.conv_0.weight
        primals_3 = self.res_1.conv_1.weight
        primals_4 = self.res_1.conv_2.weight
        primals_5 = self.res_2.conv_1.weight
        primals_6 = self.res_2.conv_2.weight
        primals_7 = self.res_3.conv_1.weight
        primals_8 = self.res_3.conv_2.weight
        primals_9 = self.res_3.conv_s.weight
        primals_10 = self.res_4.conv_1.weight
        primals_11 = self.res_4.conv_2.weight
        primals_12 = self.res_5.conv_1.weight
        primals_13 = self.res_5.conv_2.weight
        primals_14 = self.res_5.conv_s.weight
        primals_15 = self.res_6.conv_1.weight
        primals_16 = self.res_6.conv_2.weight
        primals_17 = self.conv_9.weight
        primals_18 = self.conv_10.weight
        primals_19 = self.conv_10.bias
        primals_1 = 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])
        return output[0]


Measured latency_ms: 0.056423