Whole code, directly can run on colab notebook.
import torchvision
import numpy as np
import torch
import torch.nn as nn
import matplotlib.pyplot as plt

# torch.backends.cudnn.benchmark = False


model = torchvision.models.resnet50(pretrained= False)
model.avgpool = nn.Identity()
model.fc = nn.Identity()
# model = ResNet50()

x_axis = range(50,301, 10)
all_t_resnet =[]
model = model.cuda().eval()
with torch.no_grad():
    for i in x_axis:
        t = []
        for _ in range(100):
            start = torch.cuda.Event(enable_timing=True)
            end = torch.cuda.Event(enable_timing=True) 
            size = [i, i]
            x= torch.randn(1,3,size[0],size[1]).cuda()
            torch.cuda.synchronize()
            start.record()  
            _ = model(x)
            end.record()
            torch.cuda.synchronize()
            measure_t = start.elapsed_time(end)
            t.append(measure_t)
        all_t_resnet.append(np.mean(t))


theoritic_resnet = (np.array(x_axis)/x_axis[-1])**2*all_t_resnet[-1]


# plt.gca().set_color_cycle(['red', 'green'])

plt.plot(x_axis, all_t_resnet)
plt.plot(x_axis, theoritic_resnet)

plt.legend(['experiment_resnet50', 'theoritical_resnet50'], loc='upper left')

plt.show()