blob: 49f88b2fc8cb4e87a41bcf7e374382bbfbfbe273 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// NOTE: This mojom should be kept in sync with the copy in Chromium's repo in
// //chromeos/services/machine_learning/public/mojom/.
// Example: A backwards-compatible interface change and corresponding
// implementation change can be made here first, then replicated to the client
// (Chromium) later.
module chromeos.machine_learning.mojom;
import "ml/mojom/tensor.mojom";
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// Remove the kMax in favour of kMaxValue after Mojo uprev (crbug.com/909719)
enum ExecuteResult {
OK = 0,
INPUT_MISSING_ERROR = 1,
UNKNOWN_INPUT_ERROR = 2,
INPUT_TYPE_ERROR = 3,
INPUT_SHAPE_ERROR = 4,
INPUT_FORMAT_ERROR = 5,
OUTPUT_MISSING_ERROR = 6,
UNKNOWN_OUTPUT_ERROR = 7,
DUPLICATE_OUTPUT_ERROR = 8,
EXECUTION_ERROR = 9,
kMax = EXECUTION_ERROR,
};
// API for performing inference on a TensorFlow graph. A given graph can be
// executed multiple times with a single instance of GraphExecutor.
interface GraphExecutor {
// Initializes input node values as specified in |inputs|, then executes the
// graph. The returned |outputs| are the values for the nodes specified in
// |output_names|.
Execute(map<string, Tensor> inputs, array<string> output_names)
=> (ExecuteResult result, array<Tensor>? outputs);
};