for weight in self.layer.weights:
mask = self.masks.get(weight.name)
if mask is not None:
new_weights.append(tf.math.multiply(weight, mask).numpy())
else:
new_weights.append(weight.numpy())
self.layer.set_weights(new_weights)
After Change
new_weights.append(weight)
if new_weights and not hasattr(new_weights[0], "numpy"):
raise RuntimeError("NNI: Compressed model can only run in eager mode")
self.layer.set_weights([weight.numpy()for weight in new_weights])
return self.layer(*inputs)