Skip to content

Commit

Permalink
Update neurovec.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AmeerHajAli authored Dec 8, 2019
1 parent 560b9d9 commit e5e1627
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions envs/neurovec.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def __init__(self, env_config):
self.vec_action_meaning = [1,2,4,8,16,32,64] # TODO: change this to match your hardware
self.interleave_action_meaning=[1,2,4,8,16] # TODO: change this to match your hardware
self.action_space = spaces.Tuple([spaces.Discrete(len(self.vec_action_meaning)),spaces.Discrete(len(self.interleave_action_meaning))])
#TODO you might need to next line based on the size of your C code, max sure to replace 10000.0 with the highest value the parser generates

self.testfiles = [os.path.join(root, name)
for root, dirs, files in os.walk(self.new_rundir)
Expand All @@ -51,7 +50,7 @@ def __init__(self, env_config):
self.obs_len = 384 # TODO: change obs_len based on your seting in code2vec or other code embedding
self.observation_space = spaces.Box(-1.0,1.0,shape=(self.obs_len,),dtype = np.float32)
self.obs_encodings = c_code2vec_get_encodings(self.new_rundir,self.const_orig_codes,self.loops_idxs_in_orig)# TODO:change this to other code embedding if necessary
# this hsould be removed in later versions
# this should be removed in later versions
self.vec_action_meaning = [1,2,4,8,16] # TODO: change this to match your hardware
self.interleave_action_meaning=[1,2,4,8] # TODO: change this to match your hardware
self.action_space = spaces.Tuple([spaces.Discrete(len(self.vec_action_meaning)),spaces.Discrete(len(self.interleave_action_meaning))])
Expand All @@ -62,6 +61,7 @@ def __init__(self, env_config):
self.config = Config(set_defaults=True, load_from_args=False, verify=True)
self.code2vec = Code2VecModel(self.config)
self.path_extractor = CExtractor(self.config,clang_path=os.environ['CLANG_PATH'],max_leaves=MAX_LEAF_NODES)
#TODO: you might need to next line based on the size of your C code, max sure to replace 10000.0 with the highest value the parser generates
self.observation_space = spaces.Tuple([spaces.Box(0,10000,shape=(self.config.MAX_CONTEXTS,),dtype = np.int32,)]*3+[spaces.Box(0,10000.0,shape=(self.config.MAX_CONTEXTS,),dtype = np.float32)])
self.train_input_reader = self.code2vec._create_data_reader(estimator_action=EstimatorAction.Train)
if self.compile:
Expand Down

0 comments on commit e5e1627

Please sign in to comment.