def setUpClass(cls): """Restoring the graph takes a lot of time, so we do it only once here.""" cls.default_ckpt = test_util.test_src_dir_path(DEFAULT_TEST_PATH) cls.default_predictions = holparam_predictor.HolparamPredictor( cls.default_ckpt) cls.tac_dep_ckpt = test_util.test_src_dir_path(TAC_DEP_TEST_PATH) cls.tac_dep_predictions = holparam_predictor.TacDependentPredictor( cls.tac_dep_ckpt)
def testGetSavedModelPath(self): test_pairs = [ ((os.path.join(DUMMY_BASE, 'export/best_exporter/1557146333/variables/variables')), (os.path.join(DUMMY_BASE, 'export/best_exporter/1557146333/saved_model.pb'))), (test_util.test_src_dir_path(DEFAULT_TEST_PATH), test_util.test_src_dir_path(DEFAULT_SAVED_MODEL_PATH)), (test_util.test_src_dir_path(TAC_DEP_TEST_PATH), test_util.test_src_dir_path(TAC_DEP_SAVED_MODEL_PATH)) ] for input_path, expected_path in test_pairs: actual_path = holparam_predictor.get_saved_model_path(input_path) self.assertEqual(expected_path, actual_path)
def test_compute_thm_embeddings_for_thms_from_file(self): store = self.store self.assertIsNone(store.thm_embeddings) file_path = test_util.test_src_dir_path(TEST_THEOREM_DB_PATH) store.compute_embeddings_for_thms_from_db_file(file_path) db = io_util.load_theorem_database_from_file(file_path) self.thms = _process_thms(db.theorems) self.assertAllClose(store.thm_embeddings, np.array([[thm.__hash__(), 1] for thm in self.thms]))
def setUpClass(cls): """Restoring the graph takes a lot of time, so we do it only once here.""" super(TacticDependentPredictorTest, cls).setUpClass() cls.checkpoint = test_util.test_src_dir_path(TAC_DEP_TEST_PATH) cls.predictor = holparam_predictor.TacDependentPredictor(cls.checkpoint)
def setUpClass(cls): """Restoring the graph takes a lot of time, so we do it only once here.""" super(HolparamPredictorTest, cls).setUpClass() cls.checkpoint = test_util.test_src_dir_path(DEFAULT_TEST_PATH) cls.predictor = holparam_predictor.HolparamPredictor(cls.checkpoint)
from absl.testing import parameterized import tensorflow as tf from typing import List from google.protobuf import text_format from deepmath.deephol import action_generator from deepmath.deephol import deephol_pb2 from deepmath.deephol import embedding_store from deepmath.deephol import holparam_predictor from deepmath.deephol import proof_search_tree from deepmath.deephol import prover_util from deepmath.deephol import test_util from deepmath.deephol import theorem_fingerprint from deepmath.proof_assistant import proof_assistant_pb2 FLAGS = flags.FLAGS PREDICTIONS_MODEL_PREFIX = test_util.test_src_dir_path( 'deephol/test_data/default_ckpt/model.ckpt-0') HOLLIGHT_TACTICS_TEXTPB_PATH = test_util.test_src_dir_path( 'deephol/data/hollight_tactics.textpb') EQ_REFL = ( '(a (c (fun (fun A (bool)) (bool)) !) (l (v A x) (a (a (c (fun A (fun A ' '(bool))) =) (v A x)) (v A x))))') EQ_SYM = ( '(a (c (fun (fun A (bool)) (bool)) !) (l (v A x) (a (c (fun (fun A ' '(bool)) (bool)) !) (l (v A y) (a (a (c (fun (bool) (fun (bool) (bool))) ' '==>) (a (a (c (fun A (fun A (bool))) =) (v A x)) (v A y))) (a (a (c ' '(fun A (fun A (bool))) =) (v A y)) (v A x)))))))') def load_tactics(filename) -> List[deephol_pb2.Tactic]: