示例#1
0
"""
Test VGG19 Layers
"""

import sys
sys.path.insert(0, '../../python/planner')

import planner as pln
import hardware as hw
import nn

import torch

import time

hw_spec = hw.HardwareSpec(0.2, 0.8, 0.0008, 0.005, 0.64)

data_1_1 = torch.randn(1, 3, 224, 224)
conv_1_1 = nn.Conv2d(3, 64, 3, padding=1)

data_1_2 = torch.randn(1, 64, 224, 224)
conv_1_2 = nn.Conv2d(64, 64, 3, padding=1)

data_2_1 = torch.randn(1, 64, 112, 112)
conv_2_1 = nn.Conv2d(64, 128, 3, padding=1)

data_2_2 = torch.randn(1, 128, 112, 112)
conv_2_2 = nn.Conv2d(128, 128, 3, padding=1)

data_3_1 = torch.randn(1, 128, 56, 56)
conv_3_1 = nn.Conv2d(128, 256, 3, padding=1)
示例#2
0
"""

import sys

sys.path.insert(0, '../../python/planner')

import planner as pln
import hardware as hw
import nn

import torch

import time

simd_cfg_path = '../../hwcfg/simd.json'
hw_spec = hw.HardwareSpec(simd_cfg_path)

data_1 = torch.randn(1, 3, 224, 224)
conv_1 = nn.Conv2d(3, 96, 7, padding=2)

data_2_1 = torch.randn(1, 96, 55, 55)
conv_2_1 = nn.Conv2d(96, 16, 1, padding=0)

data_2_2 = torch.randn(1, 16, 55, 55)
conv_2_2 = nn.Conv2d(16, 64, 1, padding=0)
conv_2_3 = nn.Conv2d(16, 64, 3, padding=1)

data_3_1 = torch.randn(1, 128, 55, 55)
conv_3_1 = nn.Conv2d(128, 16, 1, padding=0)

data_3_2 = torch.randn(1, 32, 55, 55)
示例#3
0
import sys

sys.path.insert(0, '../../python')

import planner as pln
import hardware as hw
import dataset
import models

import torch.nn
import torch

import time

x86_cfg_path = '../../hwcfg/x86.json'
hw_spec = hw.HardwareSpec(x86_cfg_path)

data = dataset.darknet()
darknet19 = models.darknet19()

pnn = pln.Planner()

start_time = time.time()

for name, module in darknet19.named_modules():
    if isinstance(module, torch.nn.Sequential):
        continue
    pnn.set_data(data=data, module=module, hw_spec=hw_spec, layer_name=name)
    data = pnn.run('../../build')

elapsed_time = time.time() - start_time