e8e8f7625be33b009e81ec6457526382ef00d929,keras/layers/core.py,Layer,get_input,#Layer#Any#,115
Before Change
def get_input(self, train=False):
if hasattr(self, "previous"):
return self.previous.get_output(train=train)
elif hasattr(self, "input"):
return self.input
else:
raise Exception("Layer is not connected" +
After Change
if hasattr(self, "previous"):
// to avoid redundant computations,
// layer outputs are cached when possible.
if hasattr(self, "layer_cache"):
previous_layer_id = id(self.previous)
if previous_layer_id in self.layer_cache:
return self.layer_cache[previous_layer_id]
previous_output = self.previous.get_output(train=train)
if hasattr(self, "layer_cache"):
previous_layer_id = id(self.previous)
self.layer_cache[previous_layer_id] = previous_output
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: keras-team/keras
Commit Name: e8e8f7625be33b009e81ec6457526382ef00d929
Time: 2015-12-10
Author: francois.chollet@gmail.com
File Name: keras/layers/core.py
Class Name: Layer
Method Name: get_input
Project Name: keras-team/keras
Commit Name: 6429a57a3cc1e13c5a5e09af57e85bf6cf8c637b
Time: 2016-02-11
Author: Nicholas.Eggert@target.com
File Name: keras/layers/core.py
Class Name: Layer
Method Name: input_shape
Project Name: pytorch/pytorch
Commit Name: 249c21346208b682d128e28fe4480262f8b76cd8
Time: 2021-02-27
Author: benjamin.lefaudeux@gmail.com
File Name: torch/distributed/optim/zero_redundancy_optimizer.py
Class Name: ZeroRedundancyOptimizer
Method Name: state_dict