aboutsummaryrefslogtreecommitdiff
path: root/mojo/ml_service/interface.mojom
blob: c794a13e5f736995949752c82772747613dbe023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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.

// This file contains the main interface of the Machine Learning API.
// The interfaces and methods declared here allow clients to load a model and
// execute inference on it.

module chromeos.learning.mojom;

import "learning_example.mojom";
import "model.mojom";

interface GraphExecutor {
  Execute(map<string, Tensor> examples, array<string> output_names)
      => (array<Tensor> scores);
};

// 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);
};

interface ModelProvider {
  // The ModelId inside ModelSpec is used to specify the model to be loaded.
  LoadModel(ModelSpec spec, Model& request);
};