-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PiperOrigin-RevId: 601178210 Change-Id: Ic49845aa14378fb1dcac5f06476f1d61a04c498f
- Loading branch information
1 parent
c5051b5
commit dc0bce9
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2019 Google LLC | ||
// | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ============================================================================== | ||
syntax = "proto2"; | ||
|
||
package qkeras; | ||
|
||
import "google/protobuf/any.proto"; | ||
|
||
// Protobuf to represent a quantized machine learning model. | ||
message QModel { | ||
// Layers of a quantized model. | ||
repeated QLayer qlayers = 1; | ||
} | ||
|
||
// Protobuf to represent an individual layer that supports quantization. | ||
// | ||
// TODO(akshayap): Add platform agnostic way of saving weights, ideally | ||
// something that can mimic numpy arrays. | ||
message QLayer { | ||
// Layer name. | ||
optional string name = 1; | ||
// Input shape for the layer. | ||
repeated int32 input_shape = 2 [packed = true]; | ||
// Output shape for the layer. | ||
repeated int32 output_shape = 3 [packed = true]; | ||
// Quantization configuration for this layer. | ||
optional Quantization quantization = 4; | ||
// Harware parameters associated with this layer. | ||
optional HardwareParams hw_params = 5; | ||
// Model specific custom details. | ||
optional google.protobuf.Any details = 6; | ||
} | ||
|
||
// Qantization configurations for a model layer. | ||
message Quantization { | ||
// Number of bits to perform quantization. | ||
optional int32 bits = 1; | ||
// Number of bits to the left of the decimal point. | ||
optional int32 integer = 2; | ||
// The minimum allowed power of two exponent | ||
optional int32 min_po2 = 3; | ||
// The maximum allowed power of two exponent | ||
optional int32 max_po2 = 4; | ||
} | ||
|
||
// Parameters for hardware synthesis of machine learning models. | ||
message HardwareParams { | ||
// MAC bitwidth. | ||
optional int32 mac_bitwidth = 1; | ||
} |