def _add_chi_term_sum(
            self,
            optimizer_ins
    ):
        for ok, ov in optimizer_ins.items():
            if isinstance(ov['o'], list):
                # with tf.device('/cpu:0'):
                #     self._chi_contribution = tf.Print(
                #         self._chi_contribution,
                #         [self._chi_contribution],
                #         message="\n\n(ChiNoise._add_chi_term_sum)self._chi_contribution:\n"
                #     )
                changed = list()
                for o in ov['o']:
                    noise = self._get_noise(tf.shape(o))
                    noise = normalize(noise, o)
                    # with tf.device('/cpu:0'):
                    #     noise = tf.Print(
                    #         noise,
                    #         [global_norm([noise])],
                    #         message="\n\n(ChiNoise._add_chi_term_sum)noise:\n"
                    #     )
                    #     o = tf.Print(
                    #         o,
                    #         [global_norm([o])],
                    #         message="\n\n(ChiNoise._add_chi_term_sum)o:\n"
                    #     )
                    changed.append(o + self._chi_contribution * noise)
                ov['o'] = changed
                # ov['o'] = [
                #     o + self._chi_contribution * self._get_noise(tf.shape(o))
                #     for o in ov['o']
                # ]
            else:
                # with tf.device('/cpu:0'):
                #     self._chi_contribution = tf.Print(
                #         self._chi_contribution,
                #         [self._chi_contribution],
                #         message="\n\n(ChiNoise._add_chi_term_sum)self._chi_contribution:\n"
                #     )

                noise = self._get_noise(tf.shape(ov['o']))
                noise = normalize(noise, ov['o'])
                # with tf.device('/cpu:0'):
                #     noise = tf.Print(
                #         noise,
                #         [global_norm([noise])],
                #         message="\n\n(ChiNoise._add_chi_term_sum)noise:\n"
                #     )
                #     ov['o'] = tf.Print(
                #         ov['o'],
                #
                #         [global_norm([ov['o']])],
                #         message="\n\n(ChiNoise._add_chi_term_sum)ov['o']:\n"
                #     )
                ov['o'] = ov['o'] + self._chi_contribution * noise
                # ov['o'] = ov['o'] + self._chi_contribution * self._get_noise(tf.shape(ov['o']))
        return optimizer_ins
 def _add_chi_term_sum(self, optimizer_ins):
     for ok, ov in optimizer_ins.items():
         if isinstance(ov['o'], list):
             ov['o'] = [
                 o + self._chi_contribution * normalize(theta, o)
                 for o, theta in zip(ov['o'], ov['theta'])
             ]
         else:
             ov['o'] = ov['o'] + self._chi_contribution * normalize(
                 ov['theta'], ov['o'])
     return optimizer_ins