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
import math
import torch.utils.data
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


@triton.jit
def triton_poi_fused_copy_div_sub_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 4096 % 3
    x0 = xindex % 4096
    x2 = xindex // 12288
    x3 = xindex
    tmp7 = tl.load(in_ptr0 + (x0 + 12288 * x2), None, eviction_policy=
        'evict_last')
    tmp12 = tl.load(in_ptr0 + (4096 + x0 + 12288 * x2), None,
        eviction_policy='evict_last')
    tmp18 = tl.load(in_ptr0 + (8192 + x0 + 12288 * x2), None,
        eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr0 + x3, None)
    tmp0 = x1
    tmp1 = tl.full([1], 2, tl.int32)
    tmp2 = tmp0 == tmp1
    tmp3 = tl.full([1], 1, tl.int32)
    tmp4 = tmp1 == tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = tmp3 == tmp5
    tmp8 = 0.485
    tmp9 = tmp7 - tmp8
    tmp10 = 4.366812227074235
    tmp11 = tmp9 * tmp10
    tmp13 = tl.where(tmp6, tmp11, tmp12)
    tmp14 = tmp13 - tmp8
    tmp15 = 4.464285714285714
    tmp16 = tmp14 * tmp15
    tmp17 = tmp1 == tmp5
    tmp19 = tl.where(tmp17, tmp11, tmp18)
    tmp20 = tl.where(tmp4, tmp16, tmp19)
    tmp21 = tmp20 - tmp8
    tmp22 = tmp21 * tmp15
    tmp23 = tmp0 == tmp3
    tmp24 = tmp0 == tmp5
    tmp26 = tl.where(tmp24, tmp11, tmp25)
    tmp27 = tl.where(tmp23, tmp16, tmp26)
    tmp28 = tl.where(tmp2, tmp22, tmp27)
    tl.store(out_ptr0 + x3, tmp28, None)


def call(args):
    primals_1, primals_2 = args
    args.clear()
    assert_size_stride(primals_1, (4, 3, 64, 64), (12288, 4096, 64, 1))
    assert_size_stride(primals_2, (64, 3, 7, 7), (147, 49, 7, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 3, 64, 64), (12288, 4096, 64, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_copy_div_sub_0[grid(49152)](primals_1, buf0, 49152,
            XBLOCK=256, num_warps=4, num_stages=1)
        del primals_1
        buf1 = extern_kernels.convolution(buf0, primals_2, stride=(1, 1),
            padding=(3, 3), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf1, (4, 64, 64, 64), (262144, 4096, 64, 1))
    return buf1, primals_2, buf0


class ResNet_conv1New(nn.Module):

    def __init__(self, block, layers, num_classes=1000):
        self.inplanes = 64
        super(ResNet_conv1New, self).__init__()
        self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=1, padding=3,
            bias=False)
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
                m.weight.data.normal_(0, math.sqrt(2.0 / n))
            elif isinstance(m, nn.BatchNorm2d):
                m.weight.data.fill_(1)
                m.bias.data.zero_()

    def forward(self, input_0):
        primals_2 = self.conv1.weight
        primals_1 = input_0
        output = call([primals_1, primals_2])
        return output[0]


Measured latency_ms: 0.033264