TFDWConv() `depthwise_initializer` fix (#7845)
Browse files- models/tf.py +1 -1
models/tf.py
CHANGED
@@ -97,7 +97,7 @@ class TFDWConv(keras.layers.Layer):
|
|
97 |
strides=s,
|
98 |
padding='SAME' if s == 1 else 'VALID',
|
99 |
use_bias=not hasattr(w, 'bn'),
|
100 |
-
|
101 |
bias_initializer='zeros' if hasattr(w, 'bn') else keras.initializers.Constant(w.conv.bias.numpy()))
|
102 |
self.conv = conv if s == 1 else keras.Sequential([TFPad(autopad(k, p)), conv])
|
103 |
self.bn = TFBN(w.bn) if hasattr(w, 'bn') else tf.identity
|
|
|
97 |
strides=s,
|
98 |
padding='SAME' if s == 1 else 'VALID',
|
99 |
use_bias=not hasattr(w, 'bn'),
|
100 |
+
depthwise_initializer=keras.initializers.Constant(w.conv.weight.permute(2, 3, 1, 0).numpy()),
|
101 |
bias_initializer='zeros' if hasattr(w, 'bn') else keras.initializers.Constant(w.conv.bias.numpy()))
|
102 |
self.conv = conv if s == 1 else keras.Sequential([TFPad(autopad(k, p)), conv])
|
103 |
self.bn = TFBN(w.bn) if hasattr(w, 'bn') else tf.identity
|