Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 601178210
Change-Id: Ic49845aa14378fb1dcac5f06476f1d61a04c498f
  • Loading branch information
qkeras-robot authored and copybara-github committed Jan 24, 2024
1 parent c5051b5 commit dc0bce9
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions qkeras/qmodel.proto
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;
}

0 comments on commit dc0bce9

Please sign in to comment.