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.utils.data
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_0(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 256
    xnumel = 9
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y3 = yindex
    y0 = yindex % 4
    y1 = yindex // 4
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask & ymask, eviction_policy=
        'evict_last')
    tl.store(out_ptr0 + (y0 + 4 * x2 + 36 * y1), tmp0, xmask & ymask)


@triton.jit
def triton_poi_fused_1(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 16
    xnumel = 16
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y3 = yindex
    y0 = yindex % 4
    y1 = yindex // 4
    tmp0 = tl.load(in_ptr0 + (x2 + 16 * y3), xmask & ymask)
    tl.store(out_ptr0 + (y0 + 4 * x2 + 64 * y1), tmp0, xmask & ymask)


@triton.jit
def triton_poi_fused_2(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    xnumel = 9
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    tl.full([XBLOCK, YBLOCK], True, tl.int1)
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y3 = yindex
    y0 = yindex % 64
    y1 = yindex // 64
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask, eviction_policy='evict_last'
        )
    tl.store(out_ptr0 + (y0 + 64 * x2 + 576 * y1), tmp0, xmask)


@triton.jit
def triton_poi_fused_3(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    xnumel = 9
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    tl.full([XBLOCK, YBLOCK], True, tl.int1)
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y3 = yindex
    y0 = yindex % 128
    y1 = yindex // 128
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask, eviction_policy='evict_last'
        )
    tl.store(out_ptr0 + (y0 + 128 * x2 + 1152 * y1), tmp0, xmask)


@triton.jit
def triton_poi_fused_convolution_4(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x2 = xindex
    x0 = xindex % 64
    tmp0 = tl.load(in_out_ptr0 + x2, None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x2, tmp2, None)


@triton.jit
def triton_per_fused_native_group_norm_5(in_ptr0, out_ptr0, out_ptr1,
    out_ptr2, xnumel, rnumel, XBLOCK: tl.constexpr):
    xnumel = 32
    RBLOCK: tl.constexpr = 128
    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)
    r2 = rindex % 8
    r3 = rindex // 8
    x0 = xindex % 8
    x1 = xindex // 8
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (r2 + 8 * x0 + 64 * r3 + 1024 * x1), xmask,
        other=0.0)
    tmp1 = tl.full([1, 1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp3 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp3, 0)
    tmp6 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp8 = tl.where(xmask, tmp6, 0)
    tmp9 = tl.sum(tmp8, 1)[:, None]
    tmp10 = tl.full([XBLOCK, 1], 128, tl.int32)
    tmp11 = tmp10.to(tl.float32)
    tmp12 = tmp9 / tmp11
    tmp13 = tmp3 - tmp12
    tmp14 = tmp13 * tmp13
    tmp15 = tl.broadcast_to(tmp14, [XBLOCK, RBLOCK])
    tmp17 = tl.where(xmask, tmp15, 0)
    tmp18 = tl.sum(tmp17, 1)[:, None]
    tmp19 = 128.0
    tmp20 = tmp18 / tmp19
    tmp21 = 1e-05
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.rsqrt(tmp22)
    tl.store(out_ptr2 + x4, tmp23, xmask)
    tl.store(out_ptr0 + x4, tmp12, xmask)
    tl.store(out_ptr1 + x4, tmp18, xmask)


@triton.jit
def triton_poi_fused_native_group_norm_6(in_ptr0, in_ptr1, in_ptr2, in_ptr3,
    in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x0 = xindex % 64
    x2 = xindex // 1024
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp3 = tl.load(in_ptr1 + (8 * x2 + x0 // 8), None, eviction_policy=
        'evict_last')
    tmp5 = tl.load(in_ptr2 + (8 * x2 + x0 // 8), None, eviction_policy=
        'evict_last')
    tmp12 = tl.load(in_ptr3 + x0, None, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr4 + x0, None, eviction_policy='evict_last')
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = tmp2 - tmp3
    tmp6 = 128.0
    tmp7 = tmp5 / tmp6
    tmp8 = 1e-05
    tmp9 = tmp7 + tmp8
    tmp10 = libdevice.rsqrt(tmp9)
    tmp11 = tmp4 * tmp10
    tmp13 = tmp11 * tmp12
    tmp15 = tmp13 + tmp14
    tl.store(out_ptr0 + x3, tmp15, None)


@triton.jit
def triton_poi_fused_convolution_7(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x2 = xindex
    x0 = xindex % 128
    tmp0 = tl.load(in_out_ptr0 + x2, None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x2, tmp2, None)


@triton.jit
def triton_per_fused_native_group_norm_8(in_ptr0, out_ptr0, out_ptr1,
    out_ptr2, xnumel, rnumel, XBLOCK: tl.constexpr):
    xnumel = 32
    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)
    r2 = rindex % 16
    r3 = rindex // 16
    x0 = xindex % 8
    x1 = xindex // 8
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (r2 + 16 * x0 + 128 * r3 + 512 * x1), xmask,
        other=0.0)
    tmp1 = tl.full([1, 1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp3 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp3, 0)
    tmp6 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp8 = tl.where(xmask, tmp6, 0)
    tmp9 = tl.sum(tmp8, 1)[:, None]
    tmp10 = tl.full([XBLOCK, 1], 64, tl.int32)
    tmp11 = tmp10.to(tl.float32)
    tmp12 = tmp9 / tmp11
    tmp13 = tmp3 - tmp12
    tmp14 = tmp13 * tmp13
    tmp15 = tl.broadcast_to(tmp14, [XBLOCK, RBLOCK])
    tmp17 = tl.where(xmask, tmp15, 0)
    tmp18 = tl.sum(tmp17, 1)[:, None]
    tmp19 = 64.0
    tmp20 = tmp18 / tmp19
    tmp21 = 1e-05
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.rsqrt(tmp22)
    tl.store(out_ptr2 + x4, tmp23, xmask)
    tl.store(out_ptr0 + x4, tmp12, xmask)
    tl.store(out_ptr1 + x4, tmp18, xmask)


@triton.jit
def triton_poi_fused_native_group_norm_9(in_ptr0, in_ptr1, in_ptr2, in_ptr3,
    in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x0 = xindex % 128
    x2 = xindex // 512
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp3 = tl.load(in_ptr1 + (8 * x2 + x0 // 16), None, eviction_policy=
        'evict_last')
    tmp5 = tl.load(in_ptr2 + (8 * x2 + x0 // 16), None, eviction_policy=
        'evict_last')
    tmp12 = tl.load(in_ptr3 + x0, None, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr4 + x0, None, eviction_policy='evict_last')
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = tmp2 - tmp3
    tmp6 = 64.0
    tmp7 = tmp5 / tmp6
    tmp8 = 1e-05
    tmp9 = tmp7 + tmp8
    tmp10 = libdevice.rsqrt(tmp9)
    tmp11 = tmp4 * tmp10
    tmp13 = tmp11 * tmp12
    tmp15 = tmp13 + tmp14
    tl.store(out_ptr0 + x3, tmp15, None)


@triton.jit
def triton_poi_fused_mean_native_group_norm_10(in_ptr0, in_ptr1, in_ptr2,
    in_ptr3, in_ptr4, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 128
    x1 = xindex // 128
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 512 * x1), xmask)
    tmp3 = tl.load(in_ptr1 + x2 // 16, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr2 + x2 // 16, xmask, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr3 + x0, xmask, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr4 + x0, xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr0 + (128 + x0 + 512 * x1), xmask)
    tmp23 = tl.load(in_ptr0 + (256 + x0 + 512 * x1), xmask)
    tmp30 = tl.load(in_ptr0 + (384 + x0 + 512 * x1), xmask)
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = tmp2 - tmp3
    tmp6 = 64.0
    tmp7 = tmp5 / tmp6
    tmp8 = 1e-05
    tmp9 = tmp7 + tmp8
    tmp10 = libdevice.rsqrt(tmp9)
    tmp11 = tmp4 * tmp10
    tmp13 = tmp11 * tmp12
    tmp15 = tmp13 + tmp14
    tmp17 = triton_helpers.maximum(tmp1, tmp16)
    tmp18 = tmp17 - tmp3
    tmp19 = tmp18 * tmp10
    tmp20 = tmp19 * tmp12
    tmp21 = tmp20 + tmp14
    tmp22 = tmp15 + tmp21
    tmp24 = triton_helpers.maximum(tmp1, tmp23)
    tmp25 = tmp24 - tmp3
    tmp26 = tmp25 * tmp10
    tmp27 = tmp26 * tmp12
    tmp28 = tmp27 + tmp14
    tmp29 = tmp22 + tmp28
    tmp31 = triton_helpers.maximum(tmp1, tmp30)
    tmp32 = tmp31 - tmp3
    tmp33 = tmp32 * tmp10
    tmp34 = tmp33 * tmp12
    tmp35 = tmp34 + tmp14
    tmp36 = tmp29 + tmp35
    tmp37 = 4.0
    tmp38 = tmp36 / tmp37
    tl.store(out_ptr0 + x2, tmp38, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12,
        primals_13, primals_14, primals_15, primals_16, primals_17) = args
    args.clear()
    assert_size_stride(primals_1, (64, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_2, (64,), (1,))
    assert_size_stride(primals_3, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_4, (64,), (1,))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (128, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_7, (128,), (1,))
    assert_size_stride(primals_8, (128,), (1,))
    assert_size_stride(primals_9, (128,), (1,))
    assert_size_stride(primals_10, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_11, (128,), (1,))
    assert_size_stride(primals_12, (128,), (1,))
    assert_size_stride(primals_13, (128,), (1,))
    assert_size_stride(primals_14, (128, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_15, (128,), (1,))
    assert_size_stride(primals_16, (128,), (1,))
    assert_size_stride(primals_17, (128,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((64, 4, 3, 3), (36, 1, 12, 4), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_0[grid(256, 9)](primals_1, buf0, 256, 9, XBLOCK=16,
            YBLOCK=64, num_warps=4, num_stages=1)
        del primals_1
        buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 1, 16, 4), torch.float32)
        triton_poi_fused_1[grid(16, 16)](primals_3, buf1, 16, 16, XBLOCK=16,
            YBLOCK=16, num_warps=4, num_stages=1)
        del primals_3
        buf2 = empty_strided_cuda((128, 64, 3, 3), (576, 1, 192, 64), torch
            .float32)
        triton_poi_fused_2[grid(8192, 9)](primals_6, buf2, 8192, 9, XBLOCK=
            16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_6
        buf3 = empty_strided_cuda((128, 128, 3, 3), (1152, 1, 384, 128),
            torch.float32)
        triton_poi_fused_3[grid(16384, 9)](primals_10, buf3, 16384, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_10
        buf4 = empty_strided_cuda((128, 128, 3, 3), (1152, 1, 384, 128),
            torch.float32)
        triton_poi_fused_3[grid(16384, 9)](primals_14, buf4, 16384, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_14
        buf5 = extern_kernels.convolution(buf1, buf0, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf5, (4, 64, 4, 4), (1024, 1, 256, 64))
        buf6 = buf5
        del buf5
        triton_poi_fused_convolution_4[grid(4096)](buf6, primals_2, 4096,
            XBLOCK=128, num_warps=4, num_stages=1)
        del primals_2
        buf7 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        buf8 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        buf11 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        triton_per_fused_native_group_norm_5[grid(32)](buf6, buf7, buf8,
            buf11, 32, 128, XBLOCK=8, num_warps=8, num_stages=1)
        buf10 = empty_strided_cuda((4, 64, 4, 4), (1024, 1, 256, 64), torch
            .float32)
        triton_poi_fused_native_group_norm_6[grid(4096)](buf6, buf7, buf8,
            primals_4, primals_5, buf10, 4096, XBLOCK=128, num_warps=4,
            num_stages=1)
        del primals_5
        buf12 = extern_kernels.convolution(buf10, buf2, stride=(2, 2),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf12, (4, 128, 2, 2), (512, 1, 256, 128))
        buf13 = buf12
        del buf12
        triton_poi_fused_convolution_7[grid(2048)](buf13, primals_7, 2048,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_7
        buf14 = buf8
        del buf8
        buf15 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        buf18 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        triton_per_fused_native_group_norm_8[grid(32)](buf13, buf14, buf15,
            buf18, 32, 64, XBLOCK=32, num_warps=8, num_stages=1)
        buf17 = empty_strided_cuda((4, 128, 2, 2), (512, 1, 256, 128),
            torch.float32)
        triton_poi_fused_native_group_norm_9[grid(2048)](buf13, buf14,
            buf15, primals_8, primals_9, buf17, 2048, XBLOCK=256, num_warps
            =4, num_stages=1)
        del primals_9
        buf19 = extern_kernels.convolution(buf17, buf3, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf19, (4, 128, 2, 2), (512, 1, 256, 128))
        buf20 = buf19
        del buf19
        triton_poi_fused_convolution_7[grid(2048)](buf20, primals_11, 2048,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_11
        buf21 = buf15
        del buf15
        buf22 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        buf25 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        triton_per_fused_native_group_norm_8[grid(32)](buf20, buf21, buf22,
            buf25, 32, 64, XBLOCK=32, num_warps=8, num_stages=1)
        buf24 = empty_strided_cuda((4, 128, 2, 2), (512, 1, 256, 128),
            torch.float32)
        triton_poi_fused_native_group_norm_9[grid(2048)](buf20, buf21,
            buf22, primals_12, primals_13, buf24, 2048, XBLOCK=256,
            num_warps=4, num_stages=1)
        del primals_13
        buf26 = extern_kernels.convolution(buf24, buf4, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf26, (4, 128, 2, 2), (512, 1, 256, 128))
        buf27 = buf26
        del buf26
        triton_poi_fused_convolution_7[grid(2048)](buf27, primals_15, 2048,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_15
        buf28 = buf22
        del buf22
        buf29 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        buf31 = empty_strided_cuda((4, 8, 1, 1), (8, 1, 32, 32), torch.float32)
        triton_per_fused_native_group_norm_8[grid(32)](buf27, buf28, buf29,
            buf31, 32, 64, XBLOCK=32, num_warps=8, num_stages=1)
        buf32 = empty_strided_cuda((4, 128, 1, 1), (128, 1, 1, 1), torch.
            float32)
        triton_poi_fused_mean_native_group_norm_10[grid(512)](buf27, buf28,
            buf29, primals_16, primals_17, buf32, 512, XBLOCK=128,
            num_warps=4, num_stages=1)
        del buf29
        del primals_17
    return (reinterpret_tensor(buf32, (4, 128), (128, 1), 0), buf0, buf1,
        primals_4, buf2, primals_8, buf3, primals_12, buf4, primals_16,
        buf6, buf10, reinterpret_tensor(buf7, (4, 8), (8, 1), 0),
        reinterpret_tensor(buf11, (4, 8), (8, 1), 0), buf13, buf17,
        reinterpret_tensor(buf14, (4, 8), (8, 1), 0), reinterpret_tensor(
        buf18, (4, 8), (8, 1), 0), buf20, buf24, reinterpret_tensor(buf21,
        (4, 8), (8, 1), 0), reinterpret_tensor(buf25, (4, 8), (8, 1), 0),
        buf27, reinterpret_tensor(buf28, (4, 8), (8, 1), 0),
        reinterpret_tensor(buf31, (4, 8), (8, 1), 0))


class SqueezeLastTwo(nn.Module):
    """A module which squeezes the last two dimensions, ordinary squeeze can be a problem for batch size 1"""

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

    def forward(self, x):
        return x.view(x.shape[0], x.shape[1])


class MNIST_CNNNew(nn.Module):
    """
    Hand-tuned architecture for MNIST.
    Weirdness I've noticed so far with this architecture:
    - adding a linear layer after the mean-pool in features hurts
        RotatedMNIST-100 generalization severely.
    """
    n_outputs = 128

    def __init__(self, input_shape):
        super(MNIST_CNNNew, self).__init__()
        self.conv1 = nn.Conv2d(input_shape[0], 64, 3, 1, padding=1)
        self.conv2 = nn.Conv2d(64, 128, 3, stride=2, padding=1)
        self.conv3 = nn.Conv2d(128, 128, 3, 1, padding=1)
        self.conv4 = nn.Conv2d(128, 128, 3, 1, padding=1)
        self.bn0 = nn.GroupNorm(8, 64)
        self.bn1 = nn.GroupNorm(8, 128)
        self.bn2 = nn.GroupNorm(8, 128)
        self.bn3 = nn.GroupNorm(8, 128)
        self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
        self.squeezeLastTwo = SqueezeLastTwo()

    def forward(self, input_0):
        primals_1 = self.conv1.weight
        primals_2 = self.conv1.bias
        primals_6 = self.conv2.weight
        primals_7 = self.conv2.bias
        primals_10 = self.conv3.weight
        primals_8 = self.conv3.bias
        primals_14 = self.conv4.weight
        primals_9 = self.conv4.bias
        primals_4 = self.bn0.weight
        primals_5 = self.bn0.bias
        primals_11 = self.bn1.weight
        primals_12 = self.bn1.bias
        primals_13 = self.bn2.weight
        primals_15 = self.bn2.bias
        primals_16 = self.bn3.weight
        primals_17 = self.bn3.bias
        primals_3 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12, primals_13, primals_14,
            primals_15, primals_16, primals_17])
        return output[0]


Measured latency_ms: 0.059963