blob: a438f4dfdb784f8b2430571ea446070d58f0049c [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 exists in two places and must be kept in sync:
// Chromium: //chromeos/services/machine_learning/public/mojom/
// Chrome OS: src/platform2/ml/mojom/
// Example: A backwards-compatible mojom change (and corresponding
// implementation change) can be made in Chrome OS first, then replicated to the
// client (Chromium) later.
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 "ml/mojom/tensor.mojom";
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
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.
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);
};