Пример #1
0
 def _create_analysis(self, model, stop_analysis_at_tensors=[]):
     tensors_to_analyze = [x for x in iutils.to_list(model.inputs)
                           if x not in stop_analysis_at_tensors]
     gradients = iutils.to_list(ilayers.Gradient()(
         tensors_to_analyze+[model.outputs[0]]))
     return [keras.layers.Multiply()([i, g])
             for i, g in zip(tensors_to_analyze, gradients)]
Пример #2
0
 def _create_analysis(self, model):
     gradients = iutils.to_list(ilayers.Gradient()(model.inputs + [
         model.outputs[0],
     ]))
     return [
         keras.layers.Multiply()([i, g])
         for i, g in zip(model.inputs, gradients)
     ]
Пример #3
0
    def _create_analysis(self, model, stop_analysis_at_tensors=None):
        if stop_analysis_at_tensors is None:
            stop_analysis_at_tensors = []

        tensors_to_analyze = [
            x for x in iutils.to_list(model.inputs)
            if x not in stop_analysis_at_tensors
        ]
        ret = iutils.to_list(ilayers.Gradient()(tensors_to_analyze +
                                                [model.outputs[0]]))

        if self._postprocess == "abs":
            ret = ilayers.Abs()(ret)
        elif self._postprocess == "square":
            ret = ilayers.Square()(ret)

        return iutils.to_list(ret)