blob: 3a13897aef74df09c50ac13ee00c53a4a19d021a [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.
// Datatypes and interfaces of models for the Machine Learning API.
// 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/graph_executor.mojom";
enum ModelId {
UNKNOWN,
TEST_MODEL,
SMART_DIM,
kMax = SMART_DIM,
};
// 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 CreateGraphExecutorResult {
OK = 0,
MODEL_INTERPRETATION_ERROR = 1,
MEMORY_ALLOCATION_ERROR = 2,
kMax = MEMORY_ALLOCATION_ERROR,
};
struct ModelSpec {
ModelId id;
};
// The lifetime of the cached model is tied to the lifetime of the Model
// interface pipe. The Model interface pipe can be used to acquire multiple
// separate GraphExecutor instances.
interface Model {
CreateGraphExecutor(GraphExecutor& request) =>
(CreateGraphExecutorResult result);
};