Neural Network Acceleration Basics

Neural Network Acceleration Basics

Implementation process

image-20230113203422048

image-20230113203441770

image-20230113203508271

image-20230113203537998

image-20230113203559003

image-20230113203613299

image-20230113203841681

instruction execution time

image-20230113203940431

processor

image-20230113204215702

image-20230113204225349

image-20230113204312842

image-20230113204324870

image-20230113204414694

image-20230113204431226

image-20230113204502159

image-20230113204544646

image-20230113204606365

image-20230113204722216

image-20230113204813737

image-20230113204835472

image-20230113204947865

image-20230113205032249

image-20230113205053034

image-20230113205206966

Computational bottleneck calculation code

import torch
import torchvision
from tqdm import tqdm

DEVICE = "cuda:0"

model = torchvision.models.mobilenet_v2(pretrained=True)
model = model.to(DEVICE)

with torch.no_grad():
    data = torch.rand(size=[1,3,224,224])
    for i in tqdm(range(1024)):
        o = model.forward(data.to(DEVICE))

    data = torch.rand(size=[128,3,224,224])

    for i in tqdm(range(128)):
        o = model.forward(data.to(DEVICE))

image-20230113210152829

Guess you like

Origin blog.csdn.net/charles_zhang_/article/details/128698147