Пример #1
0
 def _validate(anchor_indices, data, index_shift, expected_output):
   with tf.Graph().as_default():
     output = util.scatter_by_anchor_indices(anchor_indices, data,
                                             index_shift)
     with tf.Session() as sess:
       actual_output = sess.run(output)
   self.assertAllClose(
       np.array(expected_output, dtype=np.float32), actual_output)
 def _reverse_prediction(self, raw_prediction, feature_dict, hparams):
     total_mass = feature_dict[fmap_constants.MOLECULE_WEIGHT][..., 0]
     total_mass = tf.cast(tf.round(total_mass), dtype=tf.int32)
     return util.scatter_by_anchor_indices(
         total_mass, raw_prediction,
         hparams.max_prediction_above_molecule_mass)