import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import torchvision.transforms.functional as F
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


@triton.jit
def triton_poi_fused_0(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_1(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_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 % 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_3(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    xnumel = 9
    yoffset = (tl.program_id(1) + tl.program_id(2) * tl.num_programs(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 % 256
    y1 = yindex // 256
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask, eviction_policy='evict_last'
        )
    tl.store(out_ptr0 + (y0 + 256 * x2 + 2304 * y1), tmp0, xmask)


@triton.jit
def triton_poi_fused_4(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    xnumel = 9
    yoffset = (tl.program_id(1) + tl.program_id(2) * tl.num_programs(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 % 256
    y1 = yindex // 256
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask, eviction_policy='evict_last'
        )
    tl.store(out_ptr0 + (y0 + 256 * x2 + 2304 * y1), tmp0, xmask)


@triton.jit
def triton_poi_fused_5(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    xnumel = 9
    yoffset = (tl.program_id(1) + tl.program_id(2) * tl.num_programs(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 % 512
    y1 = yindex // 512
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask, eviction_policy='evict_last'
        )
    tl.store(out_ptr0 + (y0 + 512 * x2 + 4608 * y1), tmp0, xmask)


@triton.jit
def triton_poi_fused_6(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    xnumel = 9
    yoffset = (tl.program_id(1) + tl.program_id(2) * tl.num_programs(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 % 512
    y1 = yindex // 512
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask, eviction_policy='evict_last'
        )
    tl.store(out_ptr0 + (y0 + 512 * x2 + 4608 * y1), tmp0, xmask)


@triton.jit
def triton_poi_fused_convolution_7(in_ptr0, out_ptr0, ynumel, xnumel,
    YBLOCK: tl.constexpr, XBLOCK: tl.constexpr):
    ynumel = 12
    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]
    tl.full([XBLOCK, YBLOCK], True, tl.int1)
    x2 = xindex
    y3 = yindex
    y0 = yindex % 3
    y1 = yindex // 3
    tmp0 = tl.load(in_ptr0 + (x2 + 4096 * y3), ymask, eviction_policy=
        'evict_last')
    tl.store(out_ptr0 + (y0 + 3 * x2 + 12288 * y1), tmp0, ymask)


@triton.jit
def triton_poi_fused_convolution_8(in_ptr0, out_ptr0, ynumel, xnumel,
    YBLOCK: tl.constexpr, XBLOCK: tl.constexpr):
    ynumel = 192
    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 % 3
    y1 = yindex // 3
    tmp0 = tl.load(in_ptr0 + (x2 + 9 * y3), xmask & ymask, eviction_policy=
        'evict_last')
    tl.store(out_ptr0 + (y0 + 3 * x2 + 27 * y1), tmp0, xmask & ymask)


@triton.jit
def triton_poi_fused_convolution_relu_9(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
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tl.store(in_out_ptr0 + x2, tmp4, None)


@triton.jit
def triton_poi_fused_convolution_relu_10(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_max_pool2d_with_indices_11(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)
    x2 = xindex // 2048 % 32
    x1 = xindex // 64 % 32
    x0 = xindex % 64
    x5 = xindex // 2048
    x6 = xindex
    tmp0 = -1 + 2 * x2
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 64, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tmp2 & tmp4
    tmp6 = -1 + 2 * x1
    tmp7 = tmp6 >= tmp1
    tmp8 = tmp6 < tmp3
    tmp9 = tmp7 & tmp8
    tmp10 = tmp5 & tmp9
    tmp11 = tl.load(in_ptr0 + (-4160 + x0 + 128 * x1 + 8192 * x5), tmp10,
        other=float('-inf'))
    tmp12 = 2 * x1
    tmp13 = tmp12 >= tmp1
    tmp14 = tmp12 < tmp3
    tmp15 = tmp13 & tmp14
    tmp16 = tmp5 & tmp15
    tmp17 = tl.load(in_ptr0 + (-4096 + x0 + 128 * x1 + 8192 * x5), tmp16,
        other=float('-inf'))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = 1 + 2 * x1
    tmp20 = tmp19 >= tmp1
    tmp21 = tmp19 < tmp3
    tmp22 = tmp20 & tmp21
    tmp23 = tmp5 & tmp22
    tmp24 = tl.load(in_ptr0 + (-4032 + x0 + 128 * x1 + 8192 * x5), tmp23,
        other=float('-inf'))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = 2 * x2
    tmp27 = tmp26 >= tmp1
    tmp28 = tmp26 < tmp3
    tmp29 = tmp27 & tmp28
    tmp30 = tmp29 & tmp9
    tmp31 = tl.load(in_ptr0 + (-64 + x0 + 128 * x1 + 8192 * x5), tmp30,
        other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = tmp29 & tmp15
    tmp34 = tl.load(in_ptr0 + (x0 + 128 * x1 + 8192 * x5), tmp33, other=
        float('-inf'))
    tmp35 = triton_helpers.maximum(tmp34, tmp32)
    tmp36 = tmp29 & tmp22
    tmp37 = tl.load(in_ptr0 + (64 + x0 + 128 * x1 + 8192 * x5), tmp36,
        other=float('-inf'))
    tmp38 = triton_helpers.maximum(tmp37, tmp35)
    tmp39 = 1 + 2 * x2
    tmp40 = tmp39 >= tmp1
    tmp41 = tmp39 < tmp3
    tmp42 = tmp40 & tmp41
    tmp43 = tmp42 & tmp9
    tmp44 = tl.load(in_ptr0 + (4032 + x0 + 128 * x1 + 8192 * x5), tmp43,
        other=float('-inf'))
    tmp45 = triton_helpers.maximum(tmp44, tmp38)
    tmp46 = tmp42 & tmp15
    tmp47 = tl.load(in_ptr0 + (4096 + x0 + 128 * x1 + 8192 * x5), tmp46,
        other=float('-inf'))
    tmp48 = triton_helpers.maximum(tmp47, tmp45)
    tmp49 = tmp42 & tmp22
    tmp50 = tl.load(in_ptr0 + (4160 + x0 + 128 * x1 + 8192 * x5), tmp49,
        other=float('-inf'))
    tmp51 = triton_helpers.maximum(tmp50, tmp48)
    tl.store(out_ptr0 + x6, tmp51, None)


@triton.jit
def triton_poi_fused_convolution_relu_12(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
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tl.store(in_out_ptr0 + x2, tmp4, None)


@triton.jit
def triton_poi_fused_max_pool2d_with_indices_13(in_ptr0, 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)
    x2 = xindex // 2048 % 16
    x1 = xindex // 128 % 16
    x0 = xindex % 128
    x5 = xindex // 2048
    x6 = xindex
    tmp0 = -1 + 2 * x2
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 32, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tmp2 & tmp4
    tmp6 = -1 + 2 * x1
    tmp7 = tmp6 >= tmp1
    tmp8 = tmp6 < tmp3
    tmp9 = tmp7 & tmp8
    tmp10 = tmp5 & tmp9
    tmp11 = tl.load(in_ptr0 + (-4224 + x0 + 256 * x1 + 8192 * x5), tmp10,
        other=float('-inf'))
    tmp12 = 2 * x1
    tmp13 = tmp12 >= tmp1
    tmp14 = tmp12 < tmp3
    tmp15 = tmp13 & tmp14
    tmp16 = tmp5 & tmp15
    tmp17 = tl.load(in_ptr0 + (-4096 + x0 + 256 * x1 + 8192 * x5), tmp16,
        other=float('-inf'))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = 1 + 2 * x1
    tmp20 = tmp19 >= tmp1
    tmp21 = tmp19 < tmp3
    tmp22 = tmp20 & tmp21
    tmp23 = tmp5 & tmp22
    tmp24 = tl.load(in_ptr0 + (-3968 + x0 + 256 * x1 + 8192 * x5), tmp23,
        other=float('-inf'))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = 2 * x2
    tmp27 = tmp26 >= tmp1
    tmp28 = tmp26 < tmp3
    tmp29 = tmp27 & tmp28
    tmp30 = tmp29 & tmp9
    tmp31 = tl.load(in_ptr0 + (-128 + x0 + 256 * x1 + 8192 * x5), tmp30,
        other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = tmp29 & tmp15
    tmp34 = tl.load(in_ptr0 + (x0 + 256 * x1 + 8192 * x5), tmp33, other=
        float('-inf'))
    tmp35 = triton_helpers.maximum(tmp34, tmp32)
    tmp36 = tmp29 & tmp22
    tmp37 = tl.load(in_ptr0 + (128 + x0 + 256 * x1 + 8192 * x5), tmp36,
        other=float('-inf'))
    tmp38 = triton_helpers.maximum(tmp37, tmp35)
    tmp39 = 1 + 2 * x2
    tmp40 = tmp39 >= tmp1
    tmp41 = tmp39 < tmp3
    tmp42 = tmp40 & tmp41
    tmp43 = tmp42 & tmp9
    tmp44 = tl.load(in_ptr0 + (3968 + x0 + 256 * x1 + 8192 * x5), tmp43,
        other=float('-inf'))
    tmp45 = triton_helpers.maximum(tmp44, tmp38)
    tmp46 = tmp42 & tmp15
    tmp47 = tl.load(in_ptr0 + (4096 + x0 + 256 * x1 + 8192 * x5), tmp46,
        other=float('-inf'))
    tmp48 = triton_helpers.maximum(tmp47, tmp45)
    tmp49 = tmp42 & tmp22
    tmp50 = tl.load(in_ptr0 + (4224 + x0 + 256 * x1 + 8192 * x5), tmp49,
        other=float('-inf'))
    tmp51 = triton_helpers.maximum(tmp50, tmp48)
    tmp52 = tmp17 > tmp11
    tmp53 = tl.full([1], 1, tl.int8)
    tmp54 = tl.full([1], 0, tl.int8)
    tmp55 = tl.where(tmp52, tmp53, tmp54)
    tmp56 = tmp24 > tmp18
    tmp57 = tl.full([1], 2, tl.int8)
    tmp58 = tl.where(tmp56, tmp57, tmp55)
    tmp59 = tmp31 > tmp25
    tmp60 = tl.full([1], 3, tl.int8)
    tmp61 = tl.where(tmp59, tmp60, tmp58)
    tmp62 = tmp34 > tmp32
    tmp63 = tl.full([1], 4, tl.int8)
    tmp64 = tl.where(tmp62, tmp63, tmp61)
    tmp65 = tmp37 > tmp35
    tmp66 = tl.full([1], 5, tl.int8)
    tmp67 = tl.where(tmp65, tmp66, tmp64)
    tmp68 = tmp44 > tmp38
    tmp69 = tl.full([1], 6, tl.int8)
    tmp70 = tl.where(tmp68, tmp69, tmp67)
    tmp71 = tmp47 > tmp45
    tmp72 = tl.full([1], 7, tl.int8)
    tmp73 = tl.where(tmp71, tmp72, tmp70)
    tmp74 = tmp50 > tmp48
    tmp75 = tl.full([1], 8, tl.int8)
    tmp76 = tl.where(tmp74, tmp75, tmp73)
    tl.store(out_ptr0 + x6, tmp51, None)
    tl.store(out_ptr1 + x6, tmp76, None)


@triton.jit
def triton_poi_fused_convolution_relu_14(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 % 256
    tmp0 = tl.load(in_out_ptr0 + x2, None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tl.store(in_out_ptr0 + x2, tmp4, None)


@triton.jit
def triton_poi_fused_max_pool2d_with_indices_15(in_ptr0, 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)
    x2 = xindex // 2048 % 8
    x1 = xindex // 256 % 8
    x0 = xindex % 256
    x5 = xindex // 2048
    x6 = xindex
    tmp0 = -1 + 2 * x2
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 16, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tmp2 & tmp4
    tmp6 = -1 + 2 * x1
    tmp7 = tmp6 >= tmp1
    tmp8 = tmp6 < tmp3
    tmp9 = tmp7 & tmp8
    tmp10 = tmp5 & tmp9
    tmp11 = tl.load(in_ptr0 + (-4352 + x0 + 512 * x1 + 8192 * x5), tmp10,
        other=float('-inf'))
    tmp12 = 2 * x1
    tmp13 = tmp12 >= tmp1
    tmp14 = tmp12 < tmp3
    tmp15 = tmp13 & tmp14
    tmp16 = tmp5 & tmp15
    tmp17 = tl.load(in_ptr0 + (-4096 + x0 + 512 * x1 + 8192 * x5), tmp16,
        other=float('-inf'))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = 1 + 2 * x1
    tmp20 = tmp19 >= tmp1
    tmp21 = tmp19 < tmp3
    tmp22 = tmp20 & tmp21
    tmp23 = tmp5 & tmp22
    tmp24 = tl.load(in_ptr0 + (-3840 + x0 + 512 * x1 + 8192 * x5), tmp23,
        other=float('-inf'))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = 2 * x2
    tmp27 = tmp26 >= tmp1
    tmp28 = tmp26 < tmp3
    tmp29 = tmp27 & tmp28
    tmp30 = tmp29 & tmp9
    tmp31 = tl.load(in_ptr0 + (-256 + x0 + 512 * x1 + 8192 * x5), tmp30,
        other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = tmp29 & tmp15
    tmp34 = tl.load(in_ptr0 + (x0 + 512 * x1 + 8192 * x5), tmp33, other=
        float('-inf'))
    tmp35 = triton_helpers.maximum(tmp34, tmp32)
    tmp36 = tmp29 & tmp22
    tmp37 = tl.load(in_ptr0 + (256 + x0 + 512 * x1 + 8192 * x5), tmp36,
        other=float('-inf'))
    tmp38 = triton_helpers.maximum(tmp37, tmp35)
    tmp39 = 1 + 2 * x2
    tmp40 = tmp39 >= tmp1
    tmp41 = tmp39 < tmp3
    tmp42 = tmp40 & tmp41
    tmp43 = tmp42 & tmp9
    tmp44 = tl.load(in_ptr0 + (3840 + x0 + 512 * x1 + 8192 * x5), tmp43,
        other=float('-inf'))
    tmp45 = triton_helpers.maximum(tmp44, tmp38)
    tmp46 = tmp42 & tmp15
    tmp47 = tl.load(in_ptr0 + (4096 + x0 + 512 * x1 + 8192 * x5), tmp46,
        other=float('-inf'))
    tmp48 = triton_helpers.maximum(tmp47, tmp45)
    tmp49 = tmp42 & tmp22
    tmp50 = tl.load(in_ptr0 + (4352 + x0 + 512 * x1 + 8192 * x5), tmp49,
        other=float('-inf'))
    tmp51 = triton_helpers.maximum(tmp50, tmp48)
    tmp52 = tmp17 > tmp11
    tmp53 = tl.full([1], 1, tl.int8)
    tmp54 = tl.full([1], 0, tl.int8)
    tmp55 = tl.where(tmp52, tmp53, tmp54)
    tmp56 = tmp24 > tmp18
    tmp57 = tl.full([1], 2, tl.int8)
    tmp58 = tl.where(tmp56, tmp57, tmp55)
    tmp59 = tmp31 > tmp25
    tmp60 = tl.full([1], 3, tl.int8)
    tmp61 = tl.where(tmp59, tmp60, tmp58)
    tmp62 = tmp34 > tmp32
    tmp63 = tl.full([1], 4, tl.int8)
    tmp64 = tl.where(tmp62, tmp63, tmp61)
    tmp65 = tmp37 > tmp35
    tmp66 = tl.full([1], 5, tl.int8)
    tmp67 = tl.where(tmp65, tmp66, tmp64)
    tmp68 = tmp44 > tmp38
    tmp69 = tl.full([1], 6, tl.int8)
    tmp70 = tl.where(tmp68, tmp69, tmp67)
    tmp71 = tmp47 > tmp45
    tmp72 = tl.full([1], 7, tl.int8)
    tmp73 = tl.where(tmp71, tmp72, tmp70)
    tmp74 = tmp50 > tmp48
    tmp75 = tl.full([1], 8, tl.int8)
    tmp76 = tl.where(tmp74, tmp75, tmp73)
    tl.store(out_ptr0 + x6, tmp51, None)
    tl.store(out_ptr1 + x6, tmp76, None)


@triton.jit
def triton_poi_fused_convolution_relu_16(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 % 512
    tmp0 = tl.load(in_out_ptr0 + x2, None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tl.store(in_out_ptr0 + x2, tmp4, None)


@triton.jit
def triton_poi_fused_max_pool2d_with_indices_17(in_ptr0, 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)
    x2 = xindex // 4096 % 8
    x1 = xindex // 512 % 8
    x6 = xindex
    tmp0 = -1 + x2
    tmp1 = tl.full([1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = tl.full([1], 8, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tmp2 & tmp4
    tmp6 = -1 + x1
    tmp7 = tmp6 >= tmp1
    tmp8 = tmp6 < tmp3
    tmp9 = tmp7 & tmp8
    tmp10 = tmp5 & tmp9
    tmp11 = tl.load(in_ptr0 + (-4608 + x6), tmp10, other=float('-inf'))
    tmp12 = x1
    tmp13 = tmp12 >= tmp1
    tmp14 = tmp12 < tmp3
    tmp15 = tmp13 & tmp14
    tmp16 = tmp5 & tmp15
    tmp17 = tl.load(in_ptr0 + (-4096 + x6), tmp16, other=float('-inf'))
    tmp18 = triton_helpers.maximum(tmp17, tmp11)
    tmp19 = 1 + x1
    tmp20 = tmp19 >= tmp1
    tmp21 = tmp19 < tmp3
    tmp22 = tmp20 & tmp21
    tmp23 = tmp5 & tmp22
    tmp24 = tl.load(in_ptr0 + (-3584 + x6), tmp23, other=float('-inf'))
    tmp25 = triton_helpers.maximum(tmp24, tmp18)
    tmp26 = x2
    tmp27 = tmp26 >= tmp1
    tmp28 = tmp26 < tmp3
    tmp29 = tmp27 & tmp28
    tmp30 = tmp29 & tmp9
    tmp31 = tl.load(in_ptr0 + (-512 + x6), tmp30, other=float('-inf'))
    tmp32 = triton_helpers.maximum(tmp31, tmp25)
    tmp33 = tmp29 & tmp15
    tmp34 = tl.load(in_ptr0 + x6, tmp33, other=float('-inf'))
    tmp35 = triton_helpers.maximum(tmp34, tmp32)
    tmp36 = tmp29 & tmp22
    tmp37 = tl.load(in_ptr0 + (512 + x6), tmp36, other=float('-inf'))
    tmp38 = triton_helpers.maximum(tmp37, tmp35)
    tmp39 = 1 + x2
    tmp40 = tmp39 >= tmp1
    tmp41 = tmp39 < tmp3
    tmp42 = tmp40 & tmp41
    tmp43 = tmp42 & tmp9
    tmp44 = tl.load(in_ptr0 + (3584 + x6), tmp43, other=float('-inf'))
    tmp45 = triton_helpers.maximum(tmp44, tmp38)
    tmp46 = tmp42 & tmp15
    tmp47 = tl.load(in_ptr0 + (4096 + x6), tmp46, other=float('-inf'))
    tmp48 = triton_helpers.maximum(tmp47, tmp45)
    tmp49 = tmp42 & tmp22
    tmp50 = tl.load(in_ptr0 + (4608 + x6), tmp49, other=float('-inf'))
    tmp51 = triton_helpers.maximum(tmp50, tmp48)
    tmp52 = tmp17 > tmp11
    tmp53 = tl.full([1], 1, tl.int8)
    tmp54 = tl.full([1], 0, tl.int8)
    tmp55 = tl.where(tmp52, tmp53, tmp54)
    tmp56 = tmp24 > tmp18
    tmp57 = tl.full([1], 2, tl.int8)
    tmp58 = tl.where(tmp56, tmp57, tmp55)
    tmp59 = tmp31 > tmp25
    tmp60 = tl.full([1], 3, tl.int8)
    tmp61 = tl.where(tmp59, tmp60, tmp58)
    tmp62 = tmp34 > tmp32
    tmp63 = tl.full([1], 4, tl.int8)
    tmp64 = tl.where(tmp62, tmp63, tmp61)
    tmp65 = tmp37 > tmp35
    tmp66 = tl.full([1], 5, tl.int8)
    tmp67 = tl.where(tmp65, tmp66, tmp64)
    tmp68 = tmp44 > tmp38
    tmp69 = tl.full([1], 6, tl.int8)
    tmp70 = tl.where(tmp68, tmp69, tmp67)
    tmp71 = tmp47 > tmp45
    tmp72 = tl.full([1], 7, tl.int8)
    tmp73 = tl.where(tmp71, tmp72, tmp70)
    tmp74 = tmp50 > tmp48
    tmp75 = tl.full([1], 8, tl.int8)
    tmp76 = tl.where(tmp74, tmp75, tmp73)
    tl.store(out_ptr0 + x6, tmp51, None)
    tl.store(out_ptr1 + x6, tmp76, None)


@triton.jit
def triton_poi_fused_convolution_relu_18(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 % 1024
    tmp0 = tl.load(in_out_ptr0 + x2, None)
    tmp1 = tl.load(in_ptr0 + x0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tl.store(in_out_ptr0 + x2, tmp4, None)


@triton.jit
def triton_poi_fused_convolution_relu_threshold_backward_19(in_ptr0,
    in_ptr1, out_ptr0, out_ptr1, ynumel, xnumel, YBLOCK: tl.constexpr,
    XBLOCK: tl.constexpr):
    xnumel = 64
    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
    y0 = yindex % 1024
    y1 = yindex // 1024
    y3 = yindex
    tmp0 = tl.load(in_ptr0 + (y0 + 1024 * x2 + 65536 * y1), xmask,
        eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + y0, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1, 1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(out_ptr0 + (x2 + 64 * y3), tmp4, xmask)
    tl.store(out_ptr1 + (y0 + 1024 * x2 + 65536 * y1), tmp6, 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, primals_24, primals_25, primals_26, primals_27,
        primals_28, primals_29, primals_30, primals_31) = args
    args.clear()
    assert_size_stride(primals_1, (64, 3, 3, 3), (27, 9, 3, 1))
    assert_size_stride(primals_2, (64,), (1,))
    assert_size_stride(primals_3, (4, 3, 64, 64), (12288, 4096, 64, 1))
    assert_size_stride(primals_4, (64, 64, 3, 3), (576, 9, 3, 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, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_9, (128,), (1,))
    assert_size_stride(primals_10, (256, 128, 3, 3), (1152, 9, 3, 1))
    assert_size_stride(primals_11, (256,), (1,))
    assert_size_stride(primals_12, (256, 256, 3, 3), (2304, 9, 3, 1))
    assert_size_stride(primals_13, (256,), (1,))
    assert_size_stride(primals_14, (256, 256, 3, 3), (2304, 9, 3, 1))
    assert_size_stride(primals_15, (256,), (1,))
    assert_size_stride(primals_16, (512, 256, 3, 3), (2304, 9, 3, 1))
    assert_size_stride(primals_17, (512,), (1,))
    assert_size_stride(primals_18, (512, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_19, (512,), (1,))
    assert_size_stride(primals_20, (512, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_21, (512,), (1,))
    assert_size_stride(primals_22, (512, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_23, (512,), (1,))
    assert_size_stride(primals_24, (512, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_25, (512,), (1,))
    assert_size_stride(primals_26, (512, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_27, (512,), (1,))
    assert_size_stride(primals_28, (1024, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_29, (1024,), (1,))
    assert_size_stride(primals_30, (1024, 1024, 1, 1), (1024, 1, 1, 1))
    assert_size_stride(primals_31, (1024,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((128, 64, 3, 3), (576, 1, 192, 64), torch
            .float32)
        get_raw_stream(0)
        triton_poi_fused_0[grid(8192, 9)](primals_6, buf0, 8192, 9, XBLOCK=
            16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_6
        buf1 = empty_strided_cuda((128, 128, 3, 3), (1152, 1, 384, 128),
            torch.float32)
        triton_poi_fused_1[grid(16384, 9)](primals_8, buf1, 16384, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_8
        buf2 = empty_strided_cuda((256, 128, 3, 3), (1152, 1, 384, 128),
            torch.float32)
        triton_poi_fused_2[grid(32768, 9)](primals_10, buf2, 32768, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_10
        buf3 = empty_strided_cuda((256, 256, 3, 3), (2304, 1, 768, 256),
            torch.float32)
        triton_poi_fused_3[grid(65536, 9)](primals_12, buf3, 65536, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_12
        buf4 = empty_strided_cuda((256, 256, 3, 3), (2304, 1, 768, 256),
            torch.float32)
        triton_poi_fused_3[grid(65536, 9)](primals_14, buf4, 65536, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_14
        buf5 = empty_strided_cuda((512, 256, 3, 3), (2304, 1, 768, 256),
            torch.float32)
        triton_poi_fused_4[grid(131072, 9)](primals_16, buf5, 131072, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_16
        buf6 = empty_strided_cuda((512, 512, 3, 3), (4608, 1, 1536, 512),
            torch.float32)
        triton_poi_fused_5[grid(262144, 9)](primals_18, buf6, 262144, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_18
        buf7 = empty_strided_cuda((512, 512, 3, 3), (4608, 1, 1536, 512),
            torch.float32)
        triton_poi_fused_5[grid(262144, 9)](primals_20, buf7, 262144, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_20
        buf8 = empty_strided_cuda((512, 512, 3, 3), (4608, 1, 1536, 512),
            torch.float32)
        triton_poi_fused_5[grid(262144, 9)](primals_22, buf8, 262144, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_22
        buf9 = empty_strided_cuda((512, 512, 3, 3), (4608, 1, 1536, 512),
            torch.float32)
        triton_poi_fused_5[grid(262144, 9)](primals_24, buf9, 262144, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_24
        buf10 = empty_strided_cuda((512, 512, 3, 3), (4608, 1, 1536, 512),
            torch.float32)
        triton_poi_fused_5[grid(262144, 9)](primals_26, buf10, 262144, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_26
        buf11 = empty_strided_cuda((1024, 512, 3, 3), (4608, 1, 1536, 512),
            torch.float32)
        triton_poi_fused_6[grid(524288, 9)](primals_28, buf11, 524288, 9,
            XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_28
        buf12 = empty_strided_cuda((4, 3, 64, 64), (12288, 1, 192, 3),
            torch.float32)
        triton_poi_fused_convolution_7[grid(12, 4096)](primals_3, buf12, 12,
            4096, XBLOCK=64, YBLOCK=16, num_warps=4, num_stages=1)
        del primals_3
        buf13 = empty_strided_cuda((64, 3, 3, 3), (27, 1, 9, 3), torch.float32)
        triton_poi_fused_convolution_8[grid(192, 9)](primals_1, buf13, 192,
            9, XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_1
        buf14 = extern_kernels.convolution(buf12, buf13, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf14, (4, 64, 64, 64), (262144, 1, 4096, 64))
        del buf12
        del buf13
        buf15 = buf14
        del buf14
        triton_poi_fused_convolution_relu_9[grid(1048576)](buf15, primals_2,
            1048576, XBLOCK=512, num_warps=8, num_stages=1)
        del primals_2
        buf16 = empty_strided_cuda((64, 64, 3, 3), (576, 1, 192, 64), torch
            .float32)
        triton_poi_fused_convolution_relu_10[grid(4096, 9)](primals_4,
            buf16, 4096, 9, XBLOCK=16, YBLOCK=64, num_warps=4, num_stages=1)
        del primals_4
        buf17 = extern_kernels.convolution(buf15, buf16, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf17, (4, 64, 64, 64), (262144, 1, 4096, 64))
        del buf15
        del buf16
        buf18 = buf17
        del buf17
        triton_poi_fused_convolution_relu_9[grid(1048576)](buf18, primals_5,
            1048576, XBLOCK=512, num_warps=8, num_stages=1)
        del primals_5
        buf19 = empty_strided_cuda((4, 64, 32, 32), (65536, 1, 2048, 64),
            torch.float32)
        triton_poi_fused_max_pool2d_with_indices_11[grid(262144)](buf18,
            buf19, 262144, XBLOCK=512, num_warps=8, num_stages=1)
        del buf18
        buf20 = extern_kernels.convolution(buf19, buf0, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf20, (4, 128, 32, 32), (131072, 1, 4096, 128))
        buf21 = buf20
        del buf20
        triton_poi_fused_convolution_relu_12[grid(524288)](buf21, primals_7,
            524288, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_7
        buf22 = extern_kernels.convolution(buf21, buf1, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf22, (4, 128, 32, 32), (131072, 1, 4096, 128))
        buf23 = buf22
        del buf22
        triton_poi_fused_convolution_relu_12[grid(524288)](buf23, primals_9,
            524288, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_9
        buf24 = empty_strided_cuda((4, 128, 16, 16), (32768, 1, 2048, 128),
            torch.float32)
        buf25 = empty_strided_cuda((4, 128, 16, 16), (32768, 1, 2048, 128),
            torch.int8)
        triton_poi_fused_max_pool2d_with_indices_13[grid(131072)](buf23,
            buf24, buf25, 131072, XBLOCK=512, num_warps=8, num_stages=1)
        buf26 = extern_kernels.convolution(buf24, buf2, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf26, (4, 256, 16, 16), (65536, 1, 4096, 256))
        buf27 = buf26
        del buf26
        triton_poi_fused_convolution_relu_14[grid(262144)](buf27,
            primals_11, 262144, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_11
        buf28 = extern_kernels.convolution(buf27, buf3, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf28, (4, 256, 16, 16), (65536, 1, 4096, 256))
        buf29 = buf28
        del buf28
        triton_poi_fused_convolution_relu_14[grid(262144)](buf29,
            primals_13, 262144, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_13
        buf30 = extern_kernels.convolution(buf29, buf4, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf30, (4, 256, 16, 16), (65536, 1, 4096, 256))
        buf31 = buf30
        del buf30
        triton_poi_fused_convolution_relu_14[grid(262144)](buf31,
            primals_15, 262144, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_15
        buf32 = empty_strided_cuda((4, 256, 8, 8), (16384, 1, 2048, 256),
            torch.float32)
        buf33 = empty_strided_cuda((4, 256, 8, 8), (16384, 1, 2048, 256),
            torch.int8)
        triton_poi_fused_max_pool2d_with_indices_15[grid(65536)](buf31,
            buf32, buf33, 65536, XBLOCK=256, num_warps=4, num_stages=1)
        buf34 = extern_kernels.convolution(buf32, buf5, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf34, (4, 512, 8, 8), (32768, 1, 4096, 512))
        buf35 = buf34
        del buf34
        triton_poi_fused_convolution_relu_16[grid(131072)](buf35,
            primals_17, 131072, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_17
        buf36 = extern_kernels.convolution(buf35, buf6, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf36, (4, 512, 8, 8), (32768, 1, 4096, 512))
        buf37 = buf36
        del buf36
        triton_poi_fused_convolution_relu_16[grid(131072)](buf37,
            primals_19, 131072, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_19
        buf38 = extern_kernels.convolution(buf37, buf7, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf38, (4, 512, 8, 8), (32768, 1, 4096, 512))
        buf39 = buf38
        del buf38
        triton_poi_fused_convolution_relu_16[grid(131072)](buf39,
            primals_21, 131072, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_21
        buf40 = empty_strided_cuda((4, 512, 8, 8), (32768, 1, 4096, 512),
            torch.float32)
        buf41 = empty_strided_cuda((4, 512, 8, 8), (32768, 1, 4096, 512),
            torch.int8)
        triton_poi_fused_max_pool2d_with_indices_17[grid(131072)](buf39,
            buf40, buf41, 131072, XBLOCK=512, num_warps=8, num_stages=1)
        buf42 = extern_kernels.convolution(buf40, buf8, stride=(1, 1),
            padding=(2, 2), dilation=(2, 2), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf42, (4, 512, 8, 8), (32768, 1, 4096, 512))
        buf43 = buf42
        del buf42
        triton_poi_fused_convolution_relu_16[grid(131072)](buf43,
            primals_23, 131072, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_23
        buf44 = extern_kernels.convolution(buf43, buf9, stride=(1, 1),
            padding=(2, 2), dilation=(2, 2), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf44, (4, 512, 8, 8), (32768, 1, 4096, 512))
        buf45 = buf44
        del buf44
        triton_poi_fused_convolution_relu_16[grid(131072)](buf45,
            primals_25, 131072, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_25
        buf46 = extern_kernels.convolution(buf45, buf10, stride=(1, 1),
            padding=(2, 2), dilation=(2, 2), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf46, (4, 512, 8, 8), (32768, 1, 4096, 512))
        buf47 = buf46
        del buf46
        triton_poi_fused_convolution_relu_16[grid(131072)](buf47,
            primals_27, 131072, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_27
        buf48 = extern_kernels.convolution(buf47, buf11, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf48, (4, 1024, 8, 8), (65536, 1, 8192, 1024))
        buf49 = buf48
        del buf48
        triton_poi_fused_convolution_relu_18[grid(262144)](buf49,
            primals_29, 262144, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_29
        buf50 = extern_kernels.convolution(buf49, primals_30, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf50, (4, 1024, 8, 8), (65536, 1, 8192, 1024))
        buf51 = empty_strided_cuda((4, 1024, 8, 8), (65536, 64, 8, 1),
            torch.float32)
        buf52 = empty_strided_cuda((4, 1024, 8, 8), (65536, 1, 8192, 1024),
            torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_19[grid(4096, 64)
            ](buf50, primals_31, buf51, buf52, 4096, 64, XBLOCK=32, YBLOCK=
            32, num_warps=4, num_stages=1)
        del buf50
        del primals_31
    return (buf51, buf0, buf1, buf2, buf3, buf4, buf5, buf6, buf7, buf8,
        buf9, buf10, buf11, primals_30, buf19, buf21, buf23, buf24, buf25,
        buf27, buf29, buf31, buf32, buf33, buf35, buf37, buf39, buf40,
        buf41, buf43, buf45, buf47, buf49, buf52)


class Normalize:

    def __init__(self, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)):
        self.mean = mean
        self.std = std

    def undo(self, imgarr):
        proc_img = imgarr.copy()
        proc_img[..., 0] = (self.std[0] * imgarr[..., 0] + self.mean[0]
            ) * 255.0
        proc_img[..., 1] = (self.std[1] * imgarr[..., 1] + self.mean[1]
            ) * 255.0
        proc_img[..., 2] = (self.std[2] * imgarr[..., 2] + self.mean[2]
            ) * 255.0
        return proc_img

    def __call__(self, img):
        imgarr = np.asarray(img)
        proc_img = np.empty_like(imgarr, np.float32)
        proc_img[..., 0] = (imgarr[..., 0] / 255.0 - self.mean[0]) / self.std[0
            ]
        proc_img[..., 1] = (imgarr[..., 1] / 255.0 - self.mean[1]) / self.std[1
            ]
        proc_img[..., 2] = (imgarr[..., 2] / 255.0 - self.mean[2]) / self.std[2
            ]
        return proc_img


class BaseNet(nn.Module):

    def __init__(self):
        super().__init__()
        self.normalize = Normalize()
        self.NormLayer = nn.BatchNorm2d
        self.not_training = []
        self.bn_frozen = []
        self.from_scratch_layers = []

    def _init_weights(self, path_to_weights):
        None
        weights_dict = torch.load(path_to_weights)
        self.load_state_dict(weights_dict, strict=False)

    def fan_out(self):
        raise NotImplementedError

    def fixed_layers(self):
        return self.not_training

    def _fix_running_stats(self, layer, fix_params=False):
        if isinstance(layer, self.NormLayer):
            self.bn_frozen.append(layer)
            if fix_params and layer not in self.not_training:
                self.not_training.append(layer)
        elif isinstance(layer, list):
            for m in layer:
                self._fix_running_stats(m, fix_params)
        else:
            for m in layer.children():
                self._fix_running_stats(m, fix_params)

    def _fix_params(self, layer):
        if isinstance(layer, nn.Conv2d) or isinstance(layer, self.NormLayer
            ) or isinstance(layer, nn.Linear):
            self.not_training.append(layer)
            if isinstance(layer, self.NormLayer):
                self.bn_frozen.append(layer)
        elif isinstance(layer, list):
            for m in layer:
                self._fix_params(m)
        elif isinstance(layer, nn.Module):
            if hasattr(layer, 'weight') or hasattr(layer, 'bias'):
                None
            for m in layer.children():
                self._fix_params(m)

    def _freeze_bn(self, layer):
        if isinstance(layer, self.NormLayer):
            layer.eval()
        elif isinstance(layer, nn.Module):
            for m in layer.children():
                self._freeze_bn(m)

    def train(self, mode=True):
        super().train(mode)
        for layer in self.not_training:
            if hasattr(layer, 'weight') and layer.weight is not None:
                layer.weight.requires_grad = False
                if hasattr(layer, 'bias') and layer.bias is not None:
                    layer.bias.requires_grad = False
            elif isinstance(layer, torch.nn.Module):
                None
        for bn_layer in self.bn_frozen:
            self._freeze_bn(bn_layer)

    def _lr_mult(self):
        return 1.0, 2.0, 10.0, 20

    def parameter_groups(self, base_lr, wd):
        w_old, b_old, w_new, b_new = self._lr_mult()
        groups = {'params': [], 'weight_decay': wd, 'lr': w_old * base_lr}, {
            'params': [], 'weight_decay': 0.0, 'lr': b_old * base_lr}, {
            'params': [], 'weight_decay': wd, 'lr': w_new * base_lr}, {'params'
            : [], 'weight_decay': 0.0, 'lr': b_new * base_lr}
        fixed_layers = self.fixed_layers()
        for m in self.modules():
            if m in fixed_layers:
                continue
            if isinstance(m, nn.Conv2d) or isinstance(m, nn.Linear
                ) or isinstance(m, self.NormLayer):
                if m.weight is not None:
                    if m in self.from_scratch_layers:
                        groups[2]['params'].append(m.weight)
                    else:
                        groups[0]['params'].append(m.weight)
                if m.bias is not None:
                    if m in self.from_scratch_layers:
                        groups[3]['params'].append(m.bias)
                    else:
                        groups[1]['params'].append(m.bias)
            elif hasattr(m, 'weight'):
                None
        for i, g in enumerate(groups):
            None
        return groups


class VGG16New(BaseNet):

    def __init__(self, fc6_dilation=1):
        super(VGG16New, self).__init__()
        self.conv1_1 = nn.Conv2d(3, 64, 3, padding=1)
        self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1)
        self.pool1 = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        self.conv2_1 = nn.Conv2d(64, 128, 3, padding=1)
        self.conv2_2 = nn.Conv2d(128, 128, 3, padding=1)
        self.pool2 = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        self.conv3_1 = nn.Conv2d(128, 256, 3, padding=1)
        self.conv3_2 = nn.Conv2d(256, 256, 3, padding=1)
        self.conv3_3 = nn.Conv2d(256, 256, 3, padding=1)
        self.pool3 = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        self.conv4_1 = nn.Conv2d(256, 512, 3, padding=1)
        self.conv4_2 = nn.Conv2d(512, 512, 3, padding=1)
        self.conv4_3 = nn.Conv2d(512, 512, 3, padding=1)
        self.pool4 = nn.MaxPool2d(kernel_size=3, stride=1, padding=1)
        self.conv5_1 = nn.Conv2d(512, 512, 3, padding=2, dilation=2)
        self.conv5_2 = nn.Conv2d(512, 512, 3, padding=2, dilation=2)
        self.conv5_3 = nn.Conv2d(512, 512, 3, padding=2, dilation=2)
        self.fc6 = nn.Conv2d(512, 1024, 3, padding=fc6_dilation, dilation=
            fc6_dilation)
        self.drop6 = nn.Dropout2d(p=0.5)
        self.fc7 = nn.Conv2d(1024, 1024, 1)
        self._fix_params([self.conv1_1, self.conv1_2])

    def fan_out(self):
        return 1024

    def forward_as_dict(self, x):
        x = F.relu(self.conv1_1(x), inplace=True)
        x = F.relu(self.conv1_2(x), inplace=True)
        x = self.pool1(x)
        x = F.relu(self.conv2_1(x), inplace=True)
        x = F.relu(self.conv2_2(x), inplace=True)
        x = self.pool2(x)
        x = F.relu(self.conv3_1(x), inplace=True)
        x = F.relu(self.conv3_2(x), inplace=True)
        x = F.relu(self.conv3_3(x), inplace=True)
        conv3 = x
        x = self.pool3(x)
        x = F.relu(self.conv4_1(x), inplace=True)
        x = F.relu(self.conv4_2(x), inplace=True)
        x = F.relu(self.conv4_3(x), inplace=True)
        x = self.pool4(x)
        x = F.relu(self.conv5_1(x), inplace=True)
        x = F.relu(self.conv5_2(x), inplace=True)
        x = F.relu(self.conv5_3(x), inplace=True)
        x = F.relu(self.fc6(x), inplace=True)
        x = self.drop6(x)
        x = F.relu(self.fc7(x), inplace=True)
        conv6 = x
        return dict({'conv3': conv3, 'conv6': conv6})

    def forward(self, input_0):
        primals_1 = self.conv1_1.weight
        primals_2 = self.conv1_1.bias
        primals_4 = self.conv1_2.weight
        primals_5 = self.conv1_2.bias
        primals_6 = self.conv2_1.weight
        primals_7 = self.conv2_1.bias
        primals_8 = self.conv2_2.weight
        primals_9 = self.conv2_2.bias
        primals_10 = self.conv3_1.weight
        primals_11 = self.conv3_1.bias
        primals_12 = self.conv3_2.weight
        primals_13 = self.conv3_2.bias
        primals_14 = self.conv3_3.weight
        primals_15 = self.conv3_3.bias
        primals_16 = self.conv4_1.weight
        primals_17 = self.conv4_1.bias
        primals_18 = self.conv4_2.weight
        primals_19 = self.conv4_2.bias
        primals_20 = self.conv4_3.weight
        primals_21 = self.conv4_3.bias
        primals_22 = self.conv5_1.weight
        primals_23 = self.conv5_1.bias
        primals_24 = self.conv5_2.weight
        primals_25 = self.conv5_2.bias
        primals_26 = self.conv5_3.weight
        primals_27 = self.conv5_3.bias
        primals_28 = self.fc6.weight
        primals_29 = self.fc6.bias
        primals_30 = self.fc7.weight
        primals_31 = self.fc7.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, primals_24,
            primals_25, primals_26, primals_27, primals_28, primals_29,
            primals_30, primals_31])
        return output[0]


Measured latency_ms: 0.014917