a13bbd0d3c739ff724c47244edcac128e9583215,deepchem/models/tensorgraph/tests/test_layers.py,TestLayers,test_hingeloss,#TestLayers#,893
Before Change
def test_hingeloss(self):
labels = 1
logits = 1
logits_tensor = np.random.rand(logits)
labels_tensor = np.random.rand(labels)
with self.test_session() as sess:
logits_tensor = tf.convert_to_tensor(logits_tensor, dtype=tf.float32)
labels_tensor = tf.convert_to_tensor(labels_tensor, dtype=tf.float32)
After Change
def test_hingeloss(self):
separation = 0.25
labels = [1, 1, 0, 0]
logits = [.3, .1, -0.3, -0.1]
losses = np.array([0, 0.15, 0, 0.15], dtype=np.float32)
with self.test_session() as sess:
logits_tensor = tf.convert_to_tensor(logits, dtype=tf.float32)
labels_tensor = tf.convert_to_tensor(labels, dtype=tf.float32)
out_tensor = HingeLoss(separation=separation)(labels_tensor,
logits_tensor)
out_tensor = out_tensor.eval()
retval = np.all(losses == np.array(out_tensor))
self.assertTrue(retval)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: deepchem/deepchem
Commit Name: a13bbd0d3c739ff724c47244edcac128e9583215
Time: 2018-04-30
Author: lilleswing@gmail.com
File Name: deepchem/models/tensorgraph/tests/test_layers.py
Class Name: TestLayers
Method Name: test_hingeloss
Project Name: geomstats/geomstats
Commit Name: ecb22f715ce7c785ef85ecbb067cf74238944a83
Time: 2018-12-12
Author: ninamio78@gmail.com
File Name: tests/test_matrices_space.py
Class Name: TestMatricesSpaceMethods
Method Name: test_make_symmetric_and_is_symmetric_vectorization
Project Name: geomstats/geomstats
Commit Name: fb5ddabf1cea71e36d62f1557f72b28dfa290af8
Time: 2018-12-13
Author: ninamio78@gmail.com
File Name: tests/test_matrices_space.py
Class Name: TestMatricesSpaceMethods
Method Name: test_make_symmetric_and_is_symmetric_vectorization