onnxruntime/onnxruntime/test/perftest/test_session.h
Changming Sun 7c514d6fef
perf test runner: support NCHW->NHWC rotation (#976)
1. Support NCHW->NHWC rotation. For some models, they have different input data for ONNX and TF. Like the mlperf resnet50 model, the onnx model expects NCHW input but TF expects NHWC. NHWC is the TensorFlow default, however NCHW is the optimal format for both MKL and CUDNN. Unless I can get another TF model in NCHW format, I have to rotate the input by myself.

2. Previously, the perf test tool only randomly pick one test data set, and repeatedly run with it again and again. This PR will load all the test data sets and do the random choice for each InferenceSession::Run().
2019-05-07 11:50:29 -07:00

23 lines
No EOL
645 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include <stdlib.h>
#include "OrtValueList.h"
namespace onnxruntime {
namespace perftest {
class TestSession {
public:
virtual std::chrono::duration<double> Run() = 0;
// TODO: implement it
// This function won't return duration, because it may vary largely.
// Please measure the perf at a higher level.
void ThreadSafeRun() { abort(); }
virtual void PreLoadTestData(size_t test_data_id, size_t input_id, OrtValue* value) = 0;
virtual ~TestSession() = default;
};
} // namespace perftest
} // namespace onnxruntime