naiveproxy/chromeos/services/machine_learning/public/mojom/tensor.mojom
2018-12-09 21:59:24 -05:00

48 lines
1.4 KiB
Plaintext

// 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 used in the Machine Learning API.
// This module is derived from the Feature proto definition of TensorFlow.
// See /tensorflow/core/example/feature.proto in the TensorFlow code.
// NOTE: This mojom should be kept in sync with the copy in Chromium OS's repo
// in src/platform2/ml/mojom/.
// Example: A backwards-compatible interface change can be made in Chromium OS
// first, then replicated and used here later.
module chromeos.machine_learning.mojom;
// Corresponds to tensorflow.BytesList protobuf:
struct StringList {
array<string> value;
};
// Corresponds to tensorflow.FloatList protobuf:
struct FloatList {
array<double> value;
};
// Corresponds to tensorflow.Int64List protobuf:
struct Int64List {
array<int64> value;
};
// Corresponds to tensorflow.Feature protobuf:
union ValueList {
StringList string_list;
FloatList float_list;
Int64List int64_list;
};
// A Tensor is a multi-dimensional array with dimensions |shape|, flattened into
// the one-dimensional array |data|.
// It is used for both the inputs (in the form of a map<string, Tensor>) and
// outputs (in the form of an array<Tensor>) of ML inference.
struct Tensor {
ValueList data;
// Each integer is the size of that dimension.
Int64List shape;
};