提交 40aed241 编写于 作者: L liuqi

Fix in/out file name in python code not match c++ format.

上级 871e3392
......@@ -44,5 +44,7 @@ class CaffeEnvType(enum.Enum):
# common functions
################################
def formatted_file_name(input_file_name, input_name):
return input_file_name + '_' + \
re.sub('[^0-9a-zA-Z]+', '_', input_name)
res = input_file_name + '_'
for c in input_name:
res += c if c.isalnum() else '_'
return res
......@@ -16,6 +16,7 @@ import argparse
import sys
import numpy as np
import re
import common
# Validation Flow:
# 1. Generate input data
......@@ -29,8 +30,7 @@ import re
def generate_data(name, shape, input_file):
np.random.seed()
data = np.random.random(shape) * 2 - 1
input_file_name = input_file + "_" + re.sub('[^0-9a-zA-Z]+', '_',
name)
input_file_name = common.formatted_file_name(input_file, name)
print 'Generate input file: ', input_file_name
data.astype(np.float32).tofile(input_file_name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册