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")

After Change


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

        with self.subTest("pybind"):
            vector_path = os.path.join(self.test_dir, "vectors_pybind.pt")
            torch.save(vectors_obj, 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)

        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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

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: Qiskit/qiskit-aqua
Commit Name: 78bcfaa51aa59074492f011a4ff99e93a2b39c2f
Time: 2020-06-24
Author: manoel@us.ibm.com
File Name: test/finance/test_data_providers.py
Class Name: TestDataProviders
Method Name: test_exchangedata


Project Name: GRAAL-Research/pytoune
Commit Name: cc50b0085728cda00df44909a971384e7c585f3f
Time: 2018-01-13
Author: fredy_14@live.fr
File Name: tests/framework/test_model.py
Class Name: ModelTest
Method Name: _test_fitting