2443550ee6915daf6e7ff6306f3dc2922752ea4b,vis/backend/tensorflow_backend.py,,modify_model_backprop,#Any#Any#,41
Before Change
// Restore original model to keep upstream callers unaffected.
idx = 0
for layer in model.layers[1:] :
if hasattr(layer, "activation"):
layer.activation = original_activations[idx]
idx += 1
After Change
for i, layer in utils.reverse_enumerate(modified_model.layers):
if hasattr(layer, "activation"):
layer.activation = tf.nn.relu
if isinstance(layer, _ADVANCED_ACTIVATIONS):
// NOTE: This code is brittle as it makes use of Keras internal serialization knowledge and might
// break in the future.
modified_layer = Activation("relu")
modified_layer.inbound_nodes = layer.inbound_nodes
modified_layer.name = layer.name
modified_model.layers[i] = modified_layer
// 3. Save model with modifications.
modified_model.save(model_path)
// 4. Register modifier and load modified model under custom context.
modifier_fn = _BACKPROP_MODIFIERS.get(backprop_modifier)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: raghakot/keras-vis
Commit Name: 2443550ee6915daf6e7ff6306f3dc2922752ea4b
Time: 2017-07-09
Author: ragha@outlook.com
File Name: vis/backend/tensorflow_backend.py
Class Name:
Method Name: modify_model_backprop
Project Name: tensorflow/models
Commit Name: 250701c644424bde6e01c9c6f180ec3e813c86f9
Time: 2020-07-28
Author: hongkuny@google.com
File Name: official/nlp/modeling/models/bert_token_classifier.py
Class Name: BertTokenClassifier
Method Name: __init__
Project Name: tensorflow/models
Commit Name: 8b77e14436e8faf126995f6e430377bd60fcb00e
Time: 2020-07-28
Author: hongkuny@google.com
File Name: official/nlp/modeling/models/bert_token_classifier.py
Class Name: BertTokenClassifier
Method Name: __init__