Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 566794963
Change-Id: Ie4b6018e972dac9e0bf79a626bdb26bfee43f5c4
  • Loading branch information
lishanok authored and copybara-github committed Sep 20, 2023
1 parent ea19e06 commit a8a7f40
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 129 deletions.
36 changes: 18 additions & 18 deletions qkeras/qconvolutional.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from tensorflow.keras.layers import InputSpec
from tensorflow.python.eager import context
from tensorflow.python.ops import array_ops

# Google internal code, commented out by copybara
from .qlayers import get_auto_range_constraint_initializer
from .qlayers import QActivation
from .quantizers import get_quantized_initializer
Expand Down Expand Up @@ -217,10 +217,10 @@ def call(self, inputs):
def get_config(self):
config = {
"kernel_quantizer": constraints.serialize(
self.kernel_quantizer_internal
self.kernel_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
"kernel_range": self.kernel_range,
"bias_range": self.bias_range,
Expand Down Expand Up @@ -371,10 +371,10 @@ def call(self, inputs):
def get_config(self):
config = {
"kernel_quantizer": constraints.serialize(
self.kernel_quantizer_internal
self.kernel_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
"kernel_range": self.kernel_range,
"bias_range": self.bias_range,
Expand Down Expand Up @@ -555,10 +555,10 @@ def call(self, inputs):
def get_config(self):
config = {
"kernel_quantizer": constraints.serialize(
self.kernel_quantizer_internal
self.kernel_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
}
base_config = super(QConv2DTranspose, self).get_config()
Expand Down Expand Up @@ -730,13 +730,13 @@ def call(self, inputs):
def get_config(self):
config = {
"depthwise_quantizer": constraints.serialize(
self.depthwise_quantizer_internal
self.depthwise_quantizer_internal# Google internal code, commented out by copybara
),
"pointwise_quantizer": constraints.serialize(
self.pointwise_quantizer_internal
self.pointwise_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
}
base_config = super(QSeparableConv1D, self).get_config()
Expand Down Expand Up @@ -891,13 +891,13 @@ def call(self, inputs):
def get_config(self):
config = {
"depthwise_quantizer": constraints.serialize(
self.depthwise_quantizer_internal
self.depthwise_quantizer_internal# Google internal code, commented out by copybara
),
"pointwise_quantizer": constraints.serialize(
self.pointwise_quantizer_internal
self.pointwise_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
}
base_config = super(QSeparableConv2D, self).get_config()
Expand Down Expand Up @@ -1076,19 +1076,19 @@ def get_config(self):
config.pop("kernel_constraint", None)
config["depth_multiplier"] = self.depth_multiplier
config["depthwise_initializer"] = initializers.serialize(
self.depthwise_initializer
self.depthwise_initializer# Google internal code, commented out by copybara
)
config["depthwise_regularizer"] = regularizers.serialize(
self.depthwise_regularizer
self.depthwise_regularizer# Google internal code, commented out by copybara
)
config["depthwise_constraint"] = constraints.serialize(
self.depthwise_constraint
self.depthwise_constraint# Google internal code, commented out by copybara
)
config["depthwise_quantizer"] = constraints.serialize(
self.depthwise_quantizer_internal
self.depthwise_quantizer_internal# Google internal code, commented out by copybara
)
config["bias_quantizer"] = constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
)
config["depthwise_range"] = self.depthwise_range
config["bias_range"] = self.bias_range
Expand Down
20 changes: 10 additions & 10 deletions qkeras/qlayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,35 +671,35 @@ def get_config(self):
config = {
"units": self.units,
"activation": activations.serialize(
self.activation
self.activation# Google internal code, commented out by copybara
),
"use_bias": self.use_bias,
"kernel_quantizer": constraints.serialize(
self.kernel_quantizer_internal
self.kernel_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
"kernel_initializer": initializers.serialize(
self.kernel_initializer
self.kernel_initializer# Google internal code, commented out by copybara
),
"bias_initializer": initializers.serialize(
self.bias_initializer
self.bias_initializer# Google internal code, commented out by copybara
),
"kernel_regularizer": regularizers.serialize(
self.kernel_regularizer
self.kernel_regularizer# Google internal code, commented out by copybara
),
"bias_regularizer": regularizers.serialize(
self.bias_regularizer
self.bias_regularizer# Google internal code, commented out by copybara
),
"activity_regularizer": regularizers.serialize(
self.activity_regularizer
self.activity_regularizer# Google internal code, commented out by copybara
),
"kernel_constraint": constraints.serialize(
self.kernel_constraint
self.kernel_constraint# Google internal code, commented out by copybara
),
"bias_constraint": constraints.serialize(
self.bias_constraint
self.bias_constraint# Google internal code, commented out by copybara
),
"kernel_range": self.kernel_range,
"bias_range": self.bias_range,
Expand Down
23 changes: 14 additions & 9 deletions qkeras/qmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,27 @@ def call(self, inputs):
def get_config(self):
config = {
"weight_quantizer": constraints.serialize(
self.weight_quantizer_internal
),
self.weight_quantizer_internal# Google internal code, commented out by copybara
),
"bias_quantizer": constraints.serialize(
self.bias_quantizer_internal
),
self.bias_quantizer_internal# Google internal code, commented out by copybara
),
"weight_initializer": constraints.serialize(
self.weight_initializer),
self.weight_initializer# Google internal code, commented out by copybara
),
"bias_initializer": constraints.serialize(
self.bias_initializer),
self.bias_initializer# Google internal code, commented out by copybara
),
"activation": constraints.serialize(
self.activation),
self.activation# Google internal code, commented out by copybara
),
"use_bias": self.use_bias,
"weight_regularizer": constraints.serialize(
self.weight_regularizer),
self.weight_regularizer# Google internal code, commented out by copybara
),
"bias_regularizer": constraints.serialize(
self.bias_regularizer),
self.bias_regularizer# Google internal code, commented out by copybara
),
}
base_config = super().get_config()
base_config.update(config)
Expand Down
26 changes: 13 additions & 13 deletions qkeras/qnormalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,43 +308,43 @@ def get_config(self):
'center': self.center,
'scale': self.scale,
'beta_quantizer': constraints.serialize(
self.beta_quantizer_internal
self.beta_quantizer_internal# Google internal code, commented out by copybara
),
'gamma_quantizer': constraints.serialize(
self.gamma_quantizer_internal
self.gamma_quantizer_internal# Google internal code, commented out by copybara
),
'mean_quantizer': constraints.serialize(
self.mean_quantizer_internal
self.mean_quantizer_internal# Google internal code, commented out by copybara
),
'variance_quantizer': constraints.serialize(
self.variance_quantizer_internal
self.variance_quantizer_internal# Google internal code, commented out by copybara
),
'beta_initializer': initializers.serialize(
self.beta_initializer
self.beta_initializer# Google internal code, commented out by copybara
),
'gamma_initializer': initializers.serialize(
self.gamma_initializer
self.gamma_initializer# Google internal code, commented out by copybara
),
'moving_mean_initializer': initializers.serialize(
self.moving_mean_initializer
self.moving_mean_initializer# Google internal code, commented out by copybara
),
'moving_variance_initializer': initializers.serialize(
self.moving_variance_initializer
self.moving_variance_initializer# Google internal code, commented out by copybara
),
'inverse_quantizer': initializers.serialize(
self.inverse_quantizer_internal
self.inverse_quantizer_internal# Google internal code, commented out by copybara
),
'beta_regularizer': regularizers.serialize(
self.beta_regularizer
self.beta_regularizer# Google internal code, commented out by copybara
),
'gamma_regularizer': regularizers.serialize(
self.gamma_regularizer
self.gamma_regularizer# Google internal code, commented out by copybara
),
'beta_constraint': constraints.serialize(
self.beta_constraint
self.beta_constraint# Google internal code, commented out by copybara
),
'gamma_constraint': constraints.serialize(
self.gamma_constraint
self.gamma_constraint# Google internal code, commented out by copybara
),
'beta_range': self.beta_range,
'gamma_range': self.gamma_range,
Expand Down
8 changes: 4 additions & 4 deletions qkeras/qpooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def call(self, inputs):
def get_config(self):
config = {
"average_quantizer": constraints.serialize(
self.average_quantizer_internal
self.average_quantizer_internal# Google internal code, commented out by copybara
),
"activation": constraints.serialize(
self.activation
self.activation# Google internal code, commented out by copybara
),
}
base_config = super(QAveragePooling2D, self).get_config()
Expand Down Expand Up @@ -202,10 +202,10 @@ def call(self, inputs):
def get_config(self):
config = {
"average_quantizer": constraints.serialize(
self.average_quantizer_internal
self.average_quantizer_internal# Google internal code, commented out by copybara
),
"activation": constraints.serialize(
self.activation
self.activation# Google internal code, commented out by copybara
),
}
base_config = super(QGlobalAveragePooling2D, self).get_config()
Expand Down
Loading

0 comments on commit a8a7f40

Please sign in to comment.