// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// NOTE: This mojom exists in two places and must be kept in sync:
// Chromium: //chromeos/services/machine_learning/public/mojom/
// Chrome OS: src/platform2/ml/mojom/
// Note: Other repos downstream of Chromium might also use this mojom.
// Example: A backwards-compatible mojom change (and corresponding
// implementation change) can be made in Chrome OS first, then replicated to the
// clients (Chromium, other downstream repos) later.
// Use //chromeos/services/machine_learning/public/mojom/roll_mojoms.sh to help
// replicate Chrome OS-side changes over to Chromium.
module chromeos.machine_learning.mojom;
// NOTE: The base directory for 'import' statements is expected to differ
// between Chromium and Chrome OS versions of this file.
import "chromeos/services/machine_learning/public/mojom/tensor.mojom";
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// Keep this enum in sync with MachineLearningServiceExecuteResultEvent in
// tools/metrics/histograms/metadata/cros_ml/enums.xml.
[Stable, Extensible]
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,
};
// API for performing inference on a TensorFlow graph. A given graph can be
// executed multiple times with a single instance of GraphExecutor.
// Next ordinal: 1
[Stable]
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@0(map<string, Tensor> inputs, array<string> output_names)
=> (ExecuteResult result, array<Tensor>? outputs);
};