blob: 7ea7d41a4a322519733efc0fe9fda1b19e3ead77 [file] [log] [blame]
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.nn.benchmark.core;
import java.nio.ByteBuffer;
/** Input and expected output pair for inference benchmark */
public class InferenceInOut {
// TODO: Support multiple inputs/outputs
// Input can be passed either directly as a byte array or indirectly through
// the input creator. This is needed to pass datasets that can not fit into
// memory at once.
public byte[] mInput;
public byte[][] mExpectedOutputs;
public int mExpectedClass;
public InputCreatorInterface mInputCreator;
public interface InputCreatorInterface {
public abstract void createInput(ByteBuffer buffer);
}
public InferenceInOut(byte[] input, byte[][] expectedOutputs, int expectedClass) {
mInput = input;
mExpectedOutputs = expectedOutputs;
mExpectedClass = expectedClass;
mInputCreator = null;
}
public InferenceInOut(InputCreatorInterface inputCreator, byte[][] expectedOutputs,
int expectedClass) {
mInput = null;
mExpectedOutputs = expectedOutputs;
mExpectedClass = expectedClass;
mInputCreator = inputCreator;
}
}