d59f2519fa91ce3c6e68845e8d4ec55f469eb8a3,tests/auto/keras/test_constraints.py,TestConstraints,test_unitnorm,#TestConstraints#,32

Before Change


        from keras.constraints import unitnorm

        normed = unitnorm(self.example_array)
        self.assertAlmostEqual(
            np.max(np.abs(np.sqrt(np.sum(normed.eval() ** 2, axis=1)) - 1.))
            , 0.)


if __name__ == "__main__":
    unittest.main()

After Change


        normalized = unitnorm(self.example_array)

        norm_of_normalized = np.sqrt(np.sum(normalized.eval()**2))
        difference = norm_of_normalized - 1. //in the unit norm constraint, it should be equal to 1.
        largest_difference = np.max(np.abs(difference))
        self.assertAlmostEqual(largest_difference, 0.)


if __name__ == "__main__":
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: keras-team/keras
Commit Name: d59f2519fa91ce3c6e68845e8d4ec55f469eb8a3
Time: 2015-07-02
Author: thomas.mccolgan@gmail.com
File Name: tests/auto/keras/test_constraints.py
Class Name: TestConstraints
Method Name: test_unitnorm


Project Name: NifTK/NiftyNet
Commit Name: 6d854ec8c54e0eb0a73635f41b0598f2d2231069
Time: 2017-09-01
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/windows_aggregator_base.py
Class Name: ImageWindowsAggregator
Method Name: crop_batch


Project Name: NifTK/NiftyNet
Commit Name: 6d854ec8c54e0eb0a73635f41b0598f2d2231069
Time: 2017-09-01
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/image_window_buffer.py
Class Name: InputBatchQueueRunner
Method Name: _create_queue_and_ops