aa7176b583f29a61f4fa050d10ba5d57bf908986,test/experimental/test_vectors.py,TestVectors,test_vectors_load_and_save,#TestVectors#,114

Before Change


        vecs = torch.stack((tensorA, tensorB), 0)
        vectors_obj = build_vectors(tokens, vecs)

        tensorC = torch.tensor([1, 1], dtype=torch.float)
        vectors_obj["b"] = tensorC

        vector_path = os.path.join(self.test_dir, "vectors.pt")
        torch.save(vectors_obj.to_ivalue(), vector_path)

After Change


            self.assertEqual(loaded_vectors_obj["b"], tensorB)
            self.assertEqual(loaded_vectors_obj["not_in_it"], expected_unk_tensor)

        with self.subTest("torchscript"):
            vector_path = os.path.join(self.test_dir, "vectors_torchscript.pt")
            torch.save(vectors_obj.to_ivalue(), vector_path)
            loaded_vectors_obj = torch.load(vector_path)

            self.assertEqual(loaded_vectors_obj["a"], tensorA)
            self.assertEqual(loaded_vectors_obj["b"], tensorB)
            self.assertEqual(loaded_vectors_obj["not_in_it"], expected_unk_tensor)

    // we separate out these errors because Windows runs into seg faults when propagating
    // exceptions from C++ using pybind11
    @unittest.skipIf(platform.system() == "Windows", "Test is known to fail on Windows.")
    def test_errors_vectors_cpp(self):
        tensorA = torch.tensor([1, 0, 0], dtype=torch.float)
        tensorB = torch.tensor([0, 1, 0], dtype=torch.float)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pytorch/text
Commit Name: aa7176b583f29a61f4fa050d10ba5d57bf908986
Time: 2020-12-22
Author: 855818+mthrok@users.noreply.github.com
File Name: test/experimental/test_vectors.py
Class Name: TestVectors
Method Name: test_vectors_load_and_save


Project Name: tensorly/tensorly
Commit Name: 9b8ad4977dd57c82b11145419ad4238cf9f7342e
Time: 2018-09-28
Author: jiminy.crist@gmail.com
File Name: tensorly/tests/test_backend.py
Class Name:
Method Name: test_set_backend


Project Name: tensorly/tensorly
Commit Name: daa2c7ea2bf2c203ddef038f2eaf9d70bc07c7d4
Time: 2020-01-01
Author: roald.marie@gmail.com
File Name: tensorly/tests/test_parafac2_tensor.py
Class Name:
Method Name: test_validate_parafac2_tensor