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.nn import Module
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_convolution_0(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 952576
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 3721 % 64
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused_bernoulli_1(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = float('nan')
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused_div_max_pool2d_with_indices_mul_relu_threshold_backward_2(
    in_ptr0, in_ptr1, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 861184
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 58
    x1 = xindex // 58 % 58
    x2 = xindex // 3364
    x3 = xindex % 3364
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 61 * x1 + 3721 * x2), xmask)
    tmp1 = tl.load(in_ptr0 + (1 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp3 = tl.load(in_ptr0 + (2 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp5 = tl.load(in_ptr0 + (3 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp7 = tl.load(in_ptr0 + (61 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp9 = tl.load(in_ptr0 + (62 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp11 = tl.load(in_ptr0 + (63 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp13 = tl.load(in_ptr0 + (64 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp15 = tl.load(in_ptr0 + (122 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp17 = tl.load(in_ptr0 + (123 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp19 = tl.load(in_ptr0 + (124 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp21 = tl.load(in_ptr0 + (125 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp23 = tl.load(in_ptr0 + (183 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp25 = tl.load(in_ptr0 + (184 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp27 = tl.load(in_ptr0 + (185 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp29 = tl.load(in_ptr0 + (186 + x0 + 61 * x1 + 3721 * x2), xmask)
    tmp79 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tmp8 = triton_helpers.maximum(tmp7, tmp6)
    tmp10 = triton_helpers.maximum(tmp9, tmp8)
    tmp12 = triton_helpers.maximum(tmp11, tmp10)
    tmp14 = triton_helpers.maximum(tmp13, tmp12)
    tmp16 = triton_helpers.maximum(tmp15, tmp14)
    tmp18 = triton_helpers.maximum(tmp17, tmp16)
    tmp20 = triton_helpers.maximum(tmp19, tmp18)
    tmp22 = triton_helpers.maximum(tmp21, tmp20)
    tmp24 = triton_helpers.maximum(tmp23, tmp22)
    tmp26 = triton_helpers.maximum(tmp25, tmp24)
    tmp28 = triton_helpers.maximum(tmp27, tmp26)
    tmp30 = triton_helpers.maximum(tmp29, tmp28)
    tmp31 = tmp1 > tmp0
    tmp32 = tl.full([1], 1, tl.int8)
    tmp33 = tl.full([1], 0, tl.int8)
    tmp34 = tl.where(tmp31, tmp32, tmp33)
    tmp35 = tmp3 > tmp2
    tmp36 = tl.full([1], 2, tl.int8)
    tmp37 = tl.where(tmp35, tmp36, tmp34)
    tmp38 = tmp5 > tmp4
    tmp39 = tl.full([1], 3, tl.int8)
    tmp40 = tl.where(tmp38, tmp39, tmp37)
    tmp41 = tmp7 > tmp6
    tmp42 = tl.full([1], 4, tl.int8)
    tmp43 = tl.where(tmp41, tmp42, tmp40)
    tmp44 = tmp9 > tmp8
    tmp45 = tl.full([1], 5, tl.int8)
    tmp46 = tl.where(tmp44, tmp45, tmp43)
    tmp47 = tmp11 > tmp10
    tmp48 = tl.full([1], 6, tl.int8)
    tmp49 = tl.where(tmp47, tmp48, tmp46)
    tmp50 = tmp13 > tmp12
    tmp51 = tl.full([1], 7, tl.int8)
    tmp52 = tl.where(tmp50, tmp51, tmp49)
    tmp53 = tmp15 > tmp14
    tmp54 = tl.full([1], 8, tl.int8)
    tmp55 = tl.where(tmp53, tmp54, tmp52)
    tmp56 = tmp17 > tmp16
    tmp57 = tl.full([1], 9, tl.int8)
    tmp58 = tl.where(tmp56, tmp57, tmp55)
    tmp59 = tmp19 > tmp18
    tmp60 = tl.full([1], 10, tl.int8)
    tmp61 = tl.where(tmp59, tmp60, tmp58)
    tmp62 = tmp21 > tmp20
    tmp63 = tl.full([1], 11, tl.int8)
    tmp64 = tl.where(tmp62, tmp63, tmp61)
    tmp65 = tmp23 > tmp22
    tmp66 = tl.full([1], 12, tl.int8)
    tmp67 = tl.where(tmp65, tmp66, tmp64)
    tmp68 = tmp25 > tmp24
    tmp69 = tl.full([1], 13, tl.int8)
    tmp70 = tl.where(tmp68, tmp69, tmp67)
    tmp71 = tmp27 > tmp26
    tmp72 = tl.full([1], 14, tl.int8)
    tmp73 = tl.where(tmp71, tmp72, tmp70)
    tmp74 = tmp29 > tmp28
    tmp75 = tl.full([1], 15, tl.int8)
    tmp76 = tl.where(tmp74, tmp75, tmp73)
    tmp77 = tl.full([1], 0, tl.int32)
    tmp78 = triton_helpers.maximum(tmp77, tmp30)
    tmp80 = 2.0
    tmp81 = tmp79 * tmp80
    tmp82 = tmp78 * tmp81
    tmp83 = 0.0
    tmp84 = tmp78 <= tmp83
    tl.store(out_ptr1 + (x3 + 3456 * x2), tmp76, xmask)
    tl.store(out_ptr2 + x4, tmp82, xmask)
    tl.store(out_ptr3 + (x3 + 3456 * x2), tmp84, xmask)


@triton.jit
def triton_poi_fused_convolution_3(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 1548800
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 3025 % 128
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused_bernoulli_4(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
    tmp0 = float('nan')
    tl.store(out_ptr0 + x0, tmp0, xmask)


@triton.jit
def triton_poi_fused_div_max_pool2d_with_indices_mul_relu_threshold_backward_5(
    in_ptr0, in_ptr1, out_ptr1, out_ptr2, out_ptr3, xnumel, XBLOCK: tl.
    constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex % 52
    x1 = xindex // 52 % 52
    x2 = xindex // 2704
    x3 = xindex % 2704
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 55 * x1 + 3025 * x2), None)
    tmp1 = tl.load(in_ptr0 + (1 + x0 + 55 * x1 + 3025 * x2), None)
    tmp3 = tl.load(in_ptr0 + (2 + x0 + 55 * x1 + 3025 * x2), None)
    tmp5 = tl.load(in_ptr0 + (3 + x0 + 55 * x1 + 3025 * x2), None)
    tmp7 = tl.load(in_ptr0 + (55 + x0 + 55 * x1 + 3025 * x2), None)
    tmp9 = tl.load(in_ptr0 + (56 + x0 + 55 * x1 + 3025 * x2), None)
    tmp11 = tl.load(in_ptr0 + (57 + x0 + 55 * x1 + 3025 * x2), None)
    tmp13 = tl.load(in_ptr0 + (58 + x0 + 55 * x1 + 3025 * x2), None)
    tmp15 = tl.load(in_ptr0 + (110 + x0 + 55 * x1 + 3025 * x2), None)
    tmp17 = tl.load(in_ptr0 + (111 + x0 + 55 * x1 + 3025 * x2), None)
    tmp19 = tl.load(in_ptr0 + (112 + x0 + 55 * x1 + 3025 * x2), None)
    tmp21 = tl.load(in_ptr0 + (113 + x0 + 55 * x1 + 3025 * x2), None)
    tmp23 = tl.load(in_ptr0 + (165 + x0 + 55 * x1 + 3025 * x2), None)
    tmp25 = tl.load(in_ptr0 + (166 + x0 + 55 * x1 + 3025 * x2), None)
    tmp27 = tl.load(in_ptr0 + (167 + x0 + 55 * x1 + 3025 * x2), None)
    tmp29 = tl.load(in_ptr0 + (168 + x0 + 55 * x1 + 3025 * x2), None)
    tmp79 = tl.load(in_ptr1 + x2, None, eviction_policy='evict_last')
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tmp8 = triton_helpers.maximum(tmp7, tmp6)
    tmp10 = triton_helpers.maximum(tmp9, tmp8)
    tmp12 = triton_helpers.maximum(tmp11, tmp10)
    tmp14 = triton_helpers.maximum(tmp13, tmp12)
    tmp16 = triton_helpers.maximum(tmp15, tmp14)
    tmp18 = triton_helpers.maximum(tmp17, tmp16)
    tmp20 = triton_helpers.maximum(tmp19, tmp18)
    tmp22 = triton_helpers.maximum(tmp21, tmp20)
    tmp24 = triton_helpers.maximum(tmp23, tmp22)
    tmp26 = triton_helpers.maximum(tmp25, tmp24)
    tmp28 = triton_helpers.maximum(tmp27, tmp26)
    tmp30 = triton_helpers.maximum(tmp29, tmp28)
    tmp31 = tmp1 > tmp0
    tmp32 = tl.full([1], 1, tl.int8)
    tmp33 = tl.full([1], 0, tl.int8)
    tmp34 = tl.where(tmp31, tmp32, tmp33)
    tmp35 = tmp3 > tmp2
    tmp36 = tl.full([1], 2, tl.int8)
    tmp37 = tl.where(tmp35, tmp36, tmp34)
    tmp38 = tmp5 > tmp4
    tmp39 = tl.full([1], 3, tl.int8)
    tmp40 = tl.where(tmp38, tmp39, tmp37)
    tmp41 = tmp7 > tmp6
    tmp42 = tl.full([1], 4, tl.int8)
    tmp43 = tl.where(tmp41, tmp42, tmp40)
    tmp44 = tmp9 > tmp8
    tmp45 = tl.full([1], 5, tl.int8)
    tmp46 = tl.where(tmp44, tmp45, tmp43)
    tmp47 = tmp11 > tmp10
    tmp48 = tl.full([1], 6, tl.int8)
    tmp49 = tl.where(tmp47, tmp48, tmp46)
    tmp50 = tmp13 > tmp12
    tmp51 = tl.full([1], 7, tl.int8)
    tmp52 = tl.where(tmp50, tmp51, tmp49)
    tmp53 = tmp15 > tmp14
    tmp54 = tl.full([1], 8, tl.int8)
    tmp55 = tl.where(tmp53, tmp54, tmp52)
    tmp56 = tmp17 > tmp16
    tmp57 = tl.full([1], 9, tl.int8)
    tmp58 = tl.where(tmp56, tmp57, tmp55)
    tmp59 = tmp19 > tmp18
    tmp60 = tl.full([1], 10, tl.int8)
    tmp61 = tl.where(tmp59, tmp60, tmp58)
    tmp62 = tmp21 > tmp20
    tmp63 = tl.full([1], 11, tl.int8)
    tmp64 = tl.where(tmp62, tmp63, tmp61)
    tmp65 = tmp23 > tmp22
    tmp66 = tl.full([1], 12, tl.int8)
    tmp67 = tl.where(tmp65, tmp66, tmp64)
    tmp68 = tmp25 > tmp24
    tmp69 = tl.full([1], 13, tl.int8)
    tmp70 = tl.where(tmp68, tmp69, tmp67)
    tmp71 = tmp27 > tmp26
    tmp72 = tl.full([1], 14, tl.int8)
    tmp73 = tl.where(tmp71, tmp72, tmp70)
    tmp74 = tmp29 > tmp28
    tmp75 = tl.full([1], 15, tl.int8)
    tmp76 = tl.where(tmp74, tmp75, tmp73)
    tmp77 = tl.full([1], 0, tl.int32)
    tmp78 = triton_helpers.maximum(tmp77, tmp30)
    tmp80 = 1.25
    tmp81 = tmp79 * tmp80
    tmp82 = tmp78 * tmp81
    tmp83 = 0.0
    tmp84 = tmp78 <= tmp83
    tl.store(out_ptr1 + (x3 + 2816 * x2), tmp76, None)
    tl.store(out_ptr2 + x4, tmp82, None)
    tl.store(out_ptr3 + (x3 + 2816 * x2), tmp84, None)


@triton.jit
def triton_poi_fused_convolution_6(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 614656
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 2401 % 64
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused_avg_pool2d_div_mul_relu_threshold_backward_7(in_ptr0,
    in_ptr1, out_ptr1, out_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 541696
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 46
    x1 = xindex // 46 % 46
    x2 = xindex // 2116
    x3 = xindex % 2116
    x4 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 49 * x1 + 2401 * x2), xmask)
    tmp1 = tl.load(in_ptr0 + (1 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp3 = tl.load(in_ptr0 + (2 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp5 = tl.load(in_ptr0 + (3 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp7 = tl.load(in_ptr0 + (49 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp9 = tl.load(in_ptr0 + (50 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp11 = tl.load(in_ptr0 + (51 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp13 = tl.load(in_ptr0 + (52 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp15 = tl.load(in_ptr0 + (98 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp17 = tl.load(in_ptr0 + (99 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp19 = tl.load(in_ptr0 + (100 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp21 = tl.load(in_ptr0 + (101 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp23 = tl.load(in_ptr0 + (147 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp25 = tl.load(in_ptr0 + (148 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp27 = tl.load(in_ptr0 + (149 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp29 = tl.load(in_ptr0 + (150 + x0 + 49 * x1 + 2401 * x2), xmask)
    tmp35 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp1 + tmp0
    tmp4 = tmp3 + tmp2
    tmp6 = tmp5 + tmp4
    tmp8 = tmp7 + tmp6
    tmp10 = tmp9 + tmp8
    tmp12 = tmp11 + tmp10
    tmp14 = tmp13 + tmp12
    tmp16 = tmp15 + tmp14
    tmp18 = tmp17 + tmp16
    tmp20 = tmp19 + tmp18
    tmp22 = tmp21 + tmp20
    tmp24 = tmp23 + tmp22
    tmp26 = tmp25 + tmp24
    tmp28 = tmp27 + tmp26
    tmp30 = tmp29 + tmp28
    tmp31 = 0.0625
    tmp32 = tmp30 * tmp31
    tmp33 = tl.full([1], 0, tl.int32)
    tmp34 = triton_helpers.maximum(tmp33, tmp32)
    tmp36 = 1.1111111111111112
    tmp37 = tmp35 * tmp36
    tmp38 = tmp34 * tmp37
    tmp39 = 0.0
    tmp40 = tmp34 <= tmp39
    tl.store(out_ptr1 + x4, tmp38, xmask)
    tl.store(out_ptr2 + (x3 + 2176 * x2), tmp40, xmask)


@triton.jit
def triton_poi_fused_convolution_8(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 236672
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 1849 % 32
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused_avg_pool2d_relu_threshold_backward_9(in_out_ptr0,
    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 % 40
    x1 = xindex // 40 % 40
    x2 = xindex // 1600
    x3 = xindex
    x4 = xindex % 1600
    tmp0 = tl.load(in_ptr0 + (x0 + 43 * x1 + 1849 * x2), None)
    tmp1 = tl.load(in_ptr0 + (1 + x0 + 43 * x1 + 1849 * x2), None)
    tmp3 = tl.load(in_ptr0 + (2 + x0 + 43 * x1 + 1849 * x2), None)
    tmp5 = tl.load(in_ptr0 + (3 + x0 + 43 * x1 + 1849 * x2), None)
    tmp7 = tl.load(in_ptr0 + (43 + x0 + 43 * x1 + 1849 * x2), None)
    tmp9 = tl.load(in_ptr0 + (44 + x0 + 43 * x1 + 1849 * x2), None)
    tmp11 = tl.load(in_ptr0 + (45 + x0 + 43 * x1 + 1849 * x2), None)
    tmp13 = tl.load(in_ptr0 + (46 + x0 + 43 * x1 + 1849 * x2), None)
    tmp15 = tl.load(in_ptr0 + (86 + x0 + 43 * x1 + 1849 * x2), None)
    tmp17 = tl.load(in_ptr0 + (87 + x0 + 43 * x1 + 1849 * x2), None)
    tmp19 = tl.load(in_ptr0 + (88 + x0 + 43 * x1 + 1849 * x2), None)
    tmp21 = tl.load(in_ptr0 + (89 + x0 + 43 * x1 + 1849 * x2), None)
    tmp23 = tl.load(in_ptr0 + (129 + x0 + 43 * x1 + 1849 * x2), None)
    tmp25 = tl.load(in_ptr0 + (130 + x0 + 43 * x1 + 1849 * x2), None)
    tmp27 = tl.load(in_ptr0 + (131 + x0 + 43 * x1 + 1849 * x2), None)
    tmp29 = tl.load(in_ptr0 + (132 + x0 + 43 * x1 + 1849 * x2), None)
    tmp2 = tmp1 + tmp0
    tmp4 = tmp3 + tmp2
    tmp6 = tmp5 + tmp4
    tmp8 = tmp7 + tmp6
    tmp10 = tmp9 + tmp8
    tmp12 = tmp11 + tmp10
    tmp14 = tmp13 + tmp12
    tmp16 = tmp15 + tmp14
    tmp18 = tmp17 + tmp16
    tmp20 = tmp19 + tmp18
    tmp22 = tmp21 + tmp20
    tmp24 = tmp23 + tmp22
    tmp26 = tmp25 + tmp24
    tmp28 = tmp27 + tmp26
    tmp30 = tmp29 + tmp28
    tmp31 = 0.0625
    tmp32 = tmp30 * tmp31
    tmp33 = tl.full([1], 0, tl.int32)
    tmp34 = triton_helpers.maximum(tmp33, tmp32)
    tmp35 = 0.0
    tmp36 = tmp34 <= tmp35
    tl.store(in_out_ptr0 + x3, tmp34, None)
    tl.store(out_ptr0 + (x4 + 1664 * x2), tmp36, None)


@triton.jit
def triton_poi_fused_relu_10(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_sigmoid_11(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.sigmoid(tmp2)
    tl.store(in_out_ptr0 + x2, tmp3, None)


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) = args
    args.clear()
    assert_size_stride(primals_1, (4, 3, 64, 64), (12288, 4096, 64, 1))
    assert_size_stride(primals_2, (64, 3, 4, 4), (48, 16, 4, 1))
    assert_size_stride(primals_3, (64,), (1,))
    assert_size_stride(primals_4, (128, 64, 4, 4), (1024, 16, 4, 1))
    assert_size_stride(primals_5, (128,), (1,))
    assert_size_stride(primals_6, (64, 128, 4, 4), (2048, 16, 4, 1))
    assert_size_stride(primals_7, (64,), (1,))
    assert_size_stride(primals_8, (32, 64, 4, 4), (1024, 16, 4, 1))
    assert_size_stride(primals_9, (32,), (1,))
    assert_size_stride(primals_10, (256, 12800), (12800, 1))
    assert_size_stride(primals_11, (256,), (1,))
    assert_size_stride(primals_12, (128, 256), (256, 1))
    assert_size_stride(primals_13, (128,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = extern_kernels.convolution(primals_1, primals_2, stride=(1, 
            1), padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf0, (4, 64, 61, 61), (238144, 3721, 61, 1))
        buf1 = buf0
        del buf0
        get_raw_stream(0)
        triton_poi_fused_convolution_0[grid(952576)](buf1, primals_3, 
            952576, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_3
        buf5 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 1, 1), torch.float32)
        triton_poi_fused_bernoulli_1[grid(256)](buf5, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        torch.ops.aten.bernoulli_.float(buf5, 0.5)
        buf3 = empty_strided_cuda((4, 64, 58, 58), (221184, 3456, 58, 1),
            torch.int8)
        buf7 = empty_strided_cuda((4, 64, 58, 58), (215296, 3364, 58, 1),
            torch.float32)
        buf34 = empty_strided_cuda((4, 64, 58, 58), (221184, 3456, 58, 1),
            torch.bool)
        triton_poi_fused_div_max_pool2d_with_indices_mul_relu_threshold_backward_2[
            grid(861184)](buf1, buf5, buf3, buf7, buf34, 861184, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf8 = extern_kernels.convolution(buf7, primals_4, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf8, (4, 128, 55, 55), (387200, 3025, 55, 1))
        buf9 = buf8
        del buf8
        triton_poi_fused_convolution_3[grid(1548800)](buf9, primals_5, 
            1548800, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_5
        buf13 = empty_strided_cuda((4, 128, 1, 1), (128, 1, 1, 1), torch.
            float32)
        triton_poi_fused_bernoulli_4[grid(512)](buf13, 512, XBLOCK=128,
            num_warps=4, num_stages=1)
        torch.ops.aten.bernoulli_.float(buf13, 0.8)
        buf11 = empty_strided_cuda((4, 128, 52, 52), (360448, 2816, 52, 1),
            torch.int8)
        buf15 = empty_strided_cuda((4, 128, 52, 52), (346112, 2704, 52, 1),
            torch.float32)
        buf33 = empty_strided_cuda((4, 128, 52, 52), (360448, 2816, 52, 1),
            torch.bool)
        triton_poi_fused_div_max_pool2d_with_indices_mul_relu_threshold_backward_5[
            grid(1384448)](buf9, buf13, buf11, buf15, buf33, 1384448,
            XBLOCK=512, num_warps=8, num_stages=1)
        buf16 = extern_kernels.convolution(buf15, primals_6, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf16, (4, 64, 49, 49), (153664, 2401, 49, 1))
        buf17 = buf16
        del buf16
        triton_poi_fused_convolution_6[grid(614656)](buf17, primals_7, 
            614656, XBLOCK=512, num_warps=8, num_stages=1)
        del primals_7
        buf20 = empty_strided_cuda((4, 64, 1, 1), (64, 1, 1, 1), torch.float32)
        triton_poi_fused_bernoulli_1[grid(256)](buf20, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        torch.ops.aten.bernoulli_.float(buf20, 0.9)
        buf22 = empty_strided_cuda((4, 64, 46, 46), (135424, 2116, 46, 1),
            torch.float32)
        buf32 = empty_strided_cuda((4, 64, 46, 46), (139264, 2176, 46, 1),
            torch.bool)
        triton_poi_fused_avg_pool2d_div_mul_relu_threshold_backward_7[grid(
            541696)](buf17, buf20, buf22, buf32, 541696, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf23 = extern_kernels.convolution(buf22, primals_8, stride=(1, 1),
            padding=(0, 0), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf23, (4, 32, 43, 43), (59168, 1849, 43, 1))
        buf24 = buf23
        del buf23
        triton_poi_fused_convolution_8[grid(236672)](buf24, primals_9, 
            236672, XBLOCK=512, num_warps=8, num_stages=1)
        del primals_9
        buf25 = empty_strided_cuda((4, 32, 40, 40), (51200, 1600, 40, 1),
            torch.float32)
        buf26 = buf25
        del buf25
        buf31 = empty_strided_cuda((4, 32, 40, 40), (53248, 1664, 40, 1),
            torch.bool)
        triton_poi_fused_avg_pool2d_relu_threshold_backward_9[grid(204800)](
            buf26, buf24, buf31, 204800, XBLOCK=512, num_warps=8, num_stages=1)
        buf27 = empty_strided_cuda((16, 256), (256, 1), torch.float32)
        extern_kernels.mm(reinterpret_tensor(buf26, (16, 12800), (12800, 1),
            0), reinterpret_tensor(primals_10, (12800, 256), (1, 12800), 0),
            out=buf27)
        buf28 = buf27
        del buf27
        triton_poi_fused_relu_10[grid(4096)](buf28, primals_11, 4096,
            XBLOCK=128, num_warps=4, num_stages=1)
        del primals_11
        buf29 = empty_strided_cuda((16, 128), (128, 1), torch.float32)
        extern_kernels.mm(buf28, reinterpret_tensor(primals_12, (256, 128),
            (1, 256), 0), out=buf29)
        buf30 = buf29
        del buf29
        triton_poi_fused_sigmoid_11[grid(2048)](buf30, primals_13, 2048,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_13
    return (buf30, primals_1, primals_2, primals_4, primals_6, primals_8,
        buf1, buf3, buf5, buf7, buf9, buf11, buf13, buf15, buf17, buf20,
        buf22, buf24, reinterpret_tensor(buf26, (16, 12800), (12800, 1), 0),
        buf28, buf30, primals_12, primals_10, buf31, buf32, buf33, buf34)


class EmbedderNew(Module):

    def __init__(self, input_size, kernel_sizes):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 64, kernel_size=kernel_sizes[0])
        self.pool1 = nn.MaxPool2d(kernel_size=kernel_sizes[1], stride=1)
        self.conv2 = nn.Conv2d(64, 128, kernel_size=kernel_sizes[2])
        self.pool2 = nn.MaxPool2d(kernel_size=kernel_sizes[3], stride=1)
        self.conv3 = nn.Conv2d(128, 64, kernel_size=kernel_sizes[4])
        self.pool3 = nn.AvgPool2d(kernel_size=kernel_sizes[5], stride=1)
        self.conv4 = nn.Conv2d(64, 32, kernel_size=kernel_sizes[6])
        self.pool4 = nn.AvgPool2d(kernel_size=kernel_sizes[7], stride=1)
        size_reduction = sum(kernel_sizes) - len(kernel_sizes)
        self.fc_input_dimension = (input_size[0] - size_reduction) * (
            input_size[1] - size_reduction) * 32
        self.fc1 = nn.Linear(self.fc_input_dimension, 256)
        self.fc2 = nn.Linear(256, 128)

    def forward(self, input_0):
        primals_2 = self.conv1.weight
        primals_3 = self.conv1.bias
        primals_4 = self.conv2.weight
        primals_5 = self.conv2.bias
        primals_6 = self.conv3.weight
        primals_7 = self.conv3.bias
        primals_8 = self.conv4.weight
        primals_9 = self.conv4.bias
        primals_10 = self.fc1.weight
        primals_11 = self.fc1.bias
        primals_12 = self.fc2.weight
        primals_13 = self.fc2.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])
        return output[0]


Measured latency_ms: 0.360416