Cleanup naming of test input to use .onnx for models. (#1337)

* Cleanup naming of test input to use .onnx for models.

* Remove file deleted on master
This commit is contained in:
Scott McKay 2019-07-04 13:10:29 +10:00 committed by GitHub
parent 0d204f3f06
commit e3919d3fce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 45 additions and 45 deletions

View file

@ -21,7 +21,7 @@ That's the most simple way.
"""
from onnxruntime.datasets import get_example
example1 = get_example("mul_1.pb")
example1 = get_example("mul_1.onnx")
import onnx
model = onnx.load(example1) # model is a ModelProto protobuf message

View file

@ -19,7 +19,7 @@ from onnxruntime.datasets import get_example
#########################
# Let's load a very simple model and compute some prediction.
example1 = get_example("mul_1.pb")
example1 = get_example("mul_1.onnx")
sess = rt.InferenceSession(example1)
input_name = sess.get_inputs()[0].name

View file

@ -96,7 +96,7 @@ ONNX_NAMESPACE::OpSchema GetMulFP16Schema() {
return schema;
}
static const std::string MUL_MODEL_URI = "testdata/mul_16.pb";
static const std::string MUL_MODEL_URI = "testdata/mul_16.onnx";
void RunSession(InferenceSession& session_object,
RunOptions& run_options,

View file

@ -123,8 +123,8 @@ class FuseExecutionProvider : public IExecutionProvider {
namespace test {
static void VerifyOutputs(const std::vector<OrtValue>& fetches, const std::vector<int64_t>& expected_dims,
const std::vector<float>& expected_values);
static const std::string MODEL_URI = "testdata/mul_1.pb";
static const std::string MODEL_URI_NO_OPSET = "testdata/mul_1.pb.noopset";
static const std::string MODEL_URI = "testdata/mul_1.onnx";
static const std::string MODEL_URI_NO_OPSET = "testdata/mul_1.noopset.onnx";
//static const std::string MODEL_URI = "./testdata/squeezenet/model.onnx"; // TODO enable this after we've weights?
static void CreateMatMulModel(std::unique_ptr<onnxruntime::Model>& p_model, ProviderType provider_type) {
@ -1122,7 +1122,7 @@ TEST(ExecutionProviderTest, FunctionInlineTest) {
TEST(InferenceSessionTests, TestTruncatedSequence) {
// model/data generated by <repo>/onnxruntime/test/testdata/CNTK/gen.py GenScan()
// Manually updated to have IR version of 4.
static const std::string LSTM_MODEL_URI = "testdata/scan_1.pb";
static const std::string LSTM_MODEL_URI = "testdata/scan_1.onnx";
// This model is a 4x forward LSTM. Parse it to find out mapping between init_state input/output
ONNX_NAMESPACE::ModelProto model_proto;
int model_fd;

View file

@ -184,11 +184,11 @@ OpKernel* CreateOptionalOpKernel(const OpKernelInfo& kernel_info) {
return new OptionalOpKernel<float>(kernel_info);
}
static const std::string MUL_MODEL_URI = "testdata/mul_1.pb";
static const std::string FOO_MODEL_URI = "testdata/foo_1.pb";
static const std::string FOO_TRUNCATE_MODEL_URI = "testdata/foo_2.pb";
static const std::string MUL_MODEL_URI = "testdata/mul_1.onnx";
static const std::string FOO_MODEL_URI = "testdata/foo_1.onnx";
static const std::string FOO_TRUNCATE_MODEL_URI = "testdata/foo_2.onnx";
static const std::string OPTIONAL_MODEL1_URI = "testdata/optional_1.pb";
static const std::string OPTIONAL_MODEL1_URI = "testdata/optional_1.onnx";
void RunSession(InferenceSession& session_object,
RunOptions& run_options,

View file

@ -322,9 +322,9 @@ TEST(ResolvingGraphTest, GraphConstruction_CheckIsAcyclic) {
auto status = graph.Resolve();
EXPECT_TRUE(status.IsOK()) << status.ErrorMessage();
EXPECT_TRUE(Model::Save(model, "graph_1.pb").IsOK());
EXPECT_TRUE(Model::Save(model, "graph_1.onnx").IsOK());
std::shared_ptr<Model> model2;
EXPECT_TRUE(Model::Load("graph_1.pb", model2).IsOK());
EXPECT_TRUE(Model::Load("graph_1.onnx", model2).IsOK());
auto model_proto = model.ToProto();
auto model_proto2 = model2->ToProto();
@ -709,9 +709,9 @@ TEST(ResolvingGraphTest, GraphConstruction_TypeInference) {
EXPECT_EQ("node_4_out_1", graph.GetOutputs()[0]->Name());
EXPECT_EQ(2, graph.GetInputs().size());
EXPECT_TRUE(Model::Save(model, "model_x.pb").IsOK());
EXPECT_TRUE(Model::Save(model, "model_x.onnx").IsOK());
std::shared_ptr<Model> loaded_model;
EXPECT_TRUE(Model::Load("model_x.pb", loaded_model).IsOK());
EXPECT_TRUE(Model::Load("model_x.onnx", loaded_model).IsOK());
EXPECT_EQ(2, loaded_model->MainGraph().GetInputs().size());
auto& graph_proto = graph.ToGraphProto();

View file

@ -32,7 +32,7 @@ TEST(MemcpyTest, copy1) {
kernel_registry_manager.RegisterKernels(execution_providers);
onnx::ModelProto mp;
std::ifstream model_istream("testdata/matmul_1.pb", std::ifstream::in | std::ifstream::binary);
std::ifstream model_istream("testdata/matmul_1.onnx", std::ifstream::in | std::ifstream::binary);
google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream);
const bool result = mp.ParseFromZeroCopyStream(&zero_copy_input) && model_istream.eof();
ASSERT_TRUE(result);

View file

@ -32,7 +32,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_allclose(output_expected, res[0], rtol=1e-05, atol=1e-08)
def testRunModel(self):
sess = onnxrt.InferenceSession(self.get_name("mul_1.pb"))
sess = onnxrt.InferenceSession(self.get_name("mul_1.onnx"))
x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
input_name = sess.get_inputs()[0].name
self.assertEqual(input_name, "X")
@ -47,7 +47,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_allclose(output_expected, res[0], rtol=1e-05, atol=1e-08)
def testRunModelFromBytes(self):
with open(self.get_name("mul_1.pb"), "rb") as f:
with open(self.get_name("mul_1.onnx"), "rb") as f:
content = f.read()
sess = onnxrt.InferenceSession(content)
x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
@ -64,7 +64,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_allclose(output_expected, res[0], rtol=1e-05, atol=1e-08)
def testRunModel2(self):
sess = onnxrt.InferenceSession(self.get_name("matmul_1.pb"))
sess = onnxrt.InferenceSession(self.get_name("matmul_1.onnx"))
x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
input_name = sess.get_inputs()[0].name
self.assertEqual(input_name, "X")
@ -82,7 +82,7 @@ class TestInferenceSession(unittest.TestCase):
so = onnxrt.SessionOptions()
so.session_log_verbosity_level = 1
so.session_logid = "MultiThreadsTest"
sess = onnxrt.InferenceSession(self.get_name("mul_1.pb"), sess_options=so)
sess = onnxrt.InferenceSession(self.get_name("mul_1.onnx"), sess_options=so)
ro1 = onnxrt.RunOptions()
ro1.run_tag = "thread1"
t1 = threading.Thread(target=self.run_model, args = (sess, ro1))
@ -99,7 +99,7 @@ class TestInferenceSession(unittest.TestCase):
self.assertTrue('CPU' in device or 'GPU' in device)
def testRunModelSymbolicInput(self):
sess = onnxrt.InferenceSession(self.get_name("matmul_2.pb"))
sess = onnxrt.InferenceSession(self.get_name("matmul_2.onnx"))
x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
input_name = sess.get_inputs()[0].name
self.assertEqual(input_name, "X")
@ -116,7 +116,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_allclose(output_expected, res[0], rtol=1e-05, atol=1e-08)
def testBooleanInputs(self):
sess = onnxrt.InferenceSession(self.get_name("logicaland.pb"))
sess = onnxrt.InferenceSession(self.get_name("logicaland.onnx"))
a = np.array([[True, True], [False, False]], dtype=np.bool)
b = np.array([[True, False], [True, False]], dtype=np.bool)
@ -148,7 +148,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_equal(output_expected, res[0])
def testStringInput1(self):
sess = onnxrt.InferenceSession(self.get_name("identity_string.pb"))
sess = onnxrt.InferenceSession(self.get_name("identity_string.onnx"))
x = np.array(['this', 'is', 'identity', 'test'], dtype=np.str).reshape((2,2))
x_name = sess.get_inputs()[0].name
@ -169,7 +169,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_equal(x, res[0])
def testStringInput2(self):
sess = onnxrt.InferenceSession(self.get_name("identity_string.pb"))
sess = onnxrt.InferenceSession(self.get_name("identity_string.onnx"))
x = np.array(['Olá', '你好', '여보세요', 'hello'], dtype=np.unicode).reshape((2,2))
x_name = sess.get_inputs()[0].name
@ -190,7 +190,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_equal(x, res[0])
def testInputBytes(self):
sess = onnxrt.InferenceSession(self.get_name("identity_string.pb"))
sess = onnxrt.InferenceSession(self.get_name("identity_string.onnx"))
x = np.array([b'this', b'is', b'identity', b'test']).reshape((2,2))
x_name = sess.get_inputs()[0].name
@ -211,7 +211,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_equal(x, res[0].astype('|S8'))
def testInputObject(self):
sess = onnxrt.InferenceSession(self.get_name("identity_string.pb"))
sess = onnxrt.InferenceSession(self.get_name("identity_string.onnx"))
x = np.array(['this', 'is', 'identity', 'test'], object).reshape((2,2))
x_name = sess.get_inputs()[0].name
@ -232,7 +232,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_equal(x, res[0])
def testInputVoid(self):
sess = onnxrt.InferenceSession(self.get_name("identity_string.pb"))
sess = onnxrt.InferenceSession(self.get_name("identity_string.onnx"))
x = np.array([b'this', b'is', b'identity', b'test'], np.void).reshape((2,2))
x_name = sess.get_inputs()[0].name
@ -256,7 +256,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_equal(expr, res[0])
def testConvAutoPad(self):
sess = onnxrt.InferenceSession(self.get_name("conv_autopad.pb"))
sess = onnxrt.InferenceSession(self.get_name("conv_autopad.onnx"))
x = np.array(25 * [1.0], dtype=np.float32).reshape((1,1,5,5))
x_name = sess.get_inputs()[0].name
@ -282,7 +282,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_allclose(output_expected, res[0])
def testZipMapStringFloat(self):
sess = onnxrt.InferenceSession(self.get_name("zipmap_stringfloat.pb"))
sess = onnxrt.InferenceSession(self.get_name("zipmap_stringfloat.onnx"))
x = np.array([1.0, 0.0, 3.0, 44.0, 23.0, 11.0], dtype=np.float32).reshape((2,3))
x_name = sess.get_inputs()[0].name
@ -301,7 +301,7 @@ class TestInferenceSession(unittest.TestCase):
self.assertEqual(output_expected, res[0])
def testZipMapInt64Float(self):
sess = onnxrt.InferenceSession(self.get_name("zipmap_int64float.pb"))
sess = onnxrt.InferenceSession(self.get_name("zipmap_int64float.onnx"))
x = np.array([1.0, 0.0, 3.0, 44.0, 23.0, 11.0], dtype=np.float32).reshape((2,3))
x_name = sess.get_inputs()[0].name
@ -320,7 +320,7 @@ class TestInferenceSession(unittest.TestCase):
def testRaiseWrongNumInputs(self):
with self.assertRaises(ValueError) as context:
sess = onnxrt.InferenceSession(self.get_name("logicaland.pb"))
sess = onnxrt.InferenceSession(self.get_name("logicaland.onnx"))
a = np.array([[True, True], [False, False]], dtype=np.bool)
res = sess.run([], {'input:0': a})
@ -340,7 +340,7 @@ class TestInferenceSession(unittest.TestCase):
def testProfilerWithSessionOptions(self):
so = onnxrt.SessionOptions()
so.enable_profiling = True
sess = onnxrt.InferenceSession(self.get_name("mul_1.pb"), sess_options=so)
sess = onnxrt.InferenceSession(self.get_name("mul_1.onnx"), sess_options=so)
x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
sess.run([], {'X': x})
profile_file = sess.end_profiling()
@ -399,7 +399,7 @@ class TestInferenceSession(unittest.TestCase):
np.testing.assert_allclose(output_expected, res[0], rtol=1e-05, atol=1e-08)
def testLabelEncoder(self):
sess = onnxrt.InferenceSession(self.get_name("LabelEncoder.pb"))
sess = onnxrt.InferenceSession(self.get_name("LabelEncoder.onnx"))
input_name = sess.get_inputs()[0].name
self.assertEqual(input_name, "input")
input_type = str(sess.get_inputs()[0].type)

View file

@ -29,7 +29,7 @@ class TestBackend(unittest.TestCase):
raise FileNotFoundError("Unable to find '{0}' or '{1}' or '{2}'".format(name, rel, res))
def testRunModel(self):
name = self.get_name("mul_1.pb")
name = self.get_name("mul_1.onnx")
rep = backend.prepare(name)
x = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32)
res = rep.run(x)

View file

@ -14,7 +14,7 @@ namespace server {
namespace test {
TEST(ExecutorTests, TestMul_1) {
const static auto model_file = "testdata/mul_1.pb";
const static auto model_file = "testdata/mul_1.onnx";
const static auto input_json = R"({"inputs":{"X":{"dims":[3,2],"dataType":1,"floatData":[1,2,3,4,5,6]}},"outputFilter":["Y"]})";
const static auto expected = R"({"outputs":{"Y":{"dims":["3","2"],"dataType":1,"floatData":[1,4,9,16,25,36]}}})";

View file

@ -13,7 +13,7 @@ namespace test {
TEST(ConfigParsingTests, AllArgs) {
char* test_argv[] = {
const_cast<char*>("/path/to/binary"),
const_cast<char*>("--model_path"), const_cast<char*>("testdata/mul_1.pb"),
const_cast<char*>("--model_path"), const_cast<char*>("testdata/mul_1.onnx"),
const_cast<char*>("--address"), const_cast<char*>("4.4.4.4"),
const_cast<char*>("--http_port"), const_cast<char*>("80"),
const_cast<char*>("--num_http_threads"), const_cast<char*>("1"),
@ -22,7 +22,7 @@ TEST(ConfigParsingTests, AllArgs) {
onnxruntime::server::ServerConfiguration config{};
Result res = config.ParseInput(11, test_argv);
EXPECT_EQ(res, Result::ContinueSuccess);
EXPECT_EQ(config.model_path, "testdata/mul_1.pb");
EXPECT_EQ(config.model_path, "testdata/mul_1.onnx");
EXPECT_EQ(config.address, "4.4.4.4");
EXPECT_EQ(config.http_port, 80);
EXPECT_EQ(config.num_http_threads, 1);
@ -32,13 +32,13 @@ TEST(ConfigParsingTests, AllArgs) {
TEST(ConfigParsingTests, Defaults) {
char* test_argv[] = {
const_cast<char*>("/path/to/binary"),
const_cast<char*>("--model"), const_cast<char*>("testdata/mul_1.pb"),
const_cast<char*>("--model"), const_cast<char*>("testdata/mul_1.onnx"),
const_cast<char*>("--num_http_threads"), const_cast<char*>("3")};
onnxruntime::server::ServerConfiguration config{};
Result res = config.ParseInput(5, test_argv);
EXPECT_EQ(res, Result::ContinueSuccess);
EXPECT_EQ(config.model_path, "testdata/mul_1.pb");
EXPECT_EQ(config.model_path, "testdata/mul_1.onnx");
EXPECT_EQ(config.address, "0.0.0.0");
EXPECT_EQ(config.http_port, 8001);
EXPECT_EQ(config.num_http_threads, 3);
@ -82,7 +82,7 @@ TEST(ConfigParsingTests, WrongLoggingLevel) {
char* test_argv[] = {
const_cast<char*>("/path/to/binary"),
const_cast<char*>("--log_level"), const_cast<char*>("not a logging level"),
const_cast<char*>("--model_path"), const_cast<char*>("testdata/mul_1.pb"),
const_cast<char*>("--model_path"), const_cast<char*>("testdata/mul_1.onnx"),
const_cast<char*>("--address"), const_cast<char*>("4.4.4.4"),
const_cast<char*>("--http_port"), const_cast<char*>("80"),
const_cast<char*>("--num_http_threads"), const_cast<char*>("1")};

View file

@ -114,10 +114,10 @@ void TestInference(Ort::Env& env, T model_uri,
&value_y);
}
static constexpr PATH_TYPE MODEL_URI = TSTR("testdata/mul_1.pb");
static constexpr PATH_TYPE CUSTOM_OP_MODEL_URI = TSTR("testdata/foo_1.pb");
static constexpr PATH_TYPE MODEL_URI = TSTR("testdata/mul_1.onnx");
static constexpr PATH_TYPE CUSTOM_OP_MODEL_URI = TSTR("testdata/foo_1.onnx");
#ifdef ENABLE_LANGUAGE_INTEROP_OPS
static constexpr PATH_TYPE PYOP_FLOAT_MODEL_URI = TSTR("testdata/pyop_1.pb");
static constexpr PATH_TYPE PYOP_FLOAT_MODEL_URI = TSTR("testdata/pyop_1.onnx");
#endif
class CApiTestWithProvider : public CApiTest,

View file

@ -170,7 +170,7 @@ TEST_F(CApiTest, model_with_external_data) {
}
TEST_F(CApiTest, model_from_array) {
const char* model_path = "testdata/matmul_1.pb";
const char* model_path = "testdata/matmul_1.onnx";
std::vector<char> buffer;
{
std::ifstream file(model_path, std::ios::binary | std::ios::ate);

Binary file not shown.

Binary file not shown.

View file

@ -303,7 +303,7 @@ static void RunSession(InferenceSession& session_object,
ASSERT_EQ(found[i], values_y[i]);
}
static const std::string MODEL_URI = "testdata/fuse_mul_1.pb";
static const std::string MODEL_URI = "testdata/fuse_mul_1.onnx";
TEST(TVMTest, CodeGen_Demo_for_Fuse_Mul) {
SessionOptions so;

View file

@ -139,7 +139,7 @@ if '--use_openvino' in sys.argv:
sys.argv.remove('--use_openvino')
# Additional examples
examples_names = ["mul_1.pb", "logreg_iris.onnx", "sigmoid.onnx"]
examples_names = ["mul_1.onnx", "logreg_iris.onnx", "sigmoid.onnx"]
examples = [path.join('datasets', x) for x in examples_names]
# Extra files such as EULA and ThirdPartyNotices