pr to master #8

Open
m7grui4p8 wants to merge 201 commits from p69201753/mindspore:cpu-kernel-reuse-1 into master
1 changed files with 15 additions and 3 deletions
Showing only changes of commit 888a5412a5 - Show all commits

View File

@ -14,9 +14,21 @@
# ============================================================================
"""hub config."""
from src.resnet_imgnet import resnet50
from mindspore import Tensor
import numpy as np
def create_network(name, *args, **kwargs):
if name == 'resnet-0.65x':
return resnet50(*args, **kwargs)
def get_index(filename):
index = []
with open(filename) as fr:
for line in fr:
ind = Tensor((np.array(line.strip('\n').split(' ')[:-1])).astype(np.int32).reshape(-1, 1))
index.append(ind)
return index
def create_network(name, rate=0.65, index_filename='index.txt', **kwargs):
index = get_index(index_filename)
if name == 'resnet50-0.65x':
return resnet50(rate=rate, index=index, **kwargs)
raise NotImplementedError(f"{name} is not implemented in the repo")