| 499 | |
| 500 | class AIBlocks: |
| 501 | def InitModel(load_path=""): |
| 502 | # Initializing the variables |
| 503 | init = tf.global_variables_initializer() |
| 504 | |
| 505 | # 'Saver' op to save and restore all the variables |
| 506 | saver = tf.train.Saver() |
| 507 | |
| 508 | sess = tf.Session() |
| 509 | sess.run(init) |
| 510 | |
| 511 | if len(load_path)>0 and os.path.exists(load_path+"/model.meta"): |
| 512 | res=saver.restore(sess, load_path+"/model") |
| 513 | Log ("Model loaded from: "+load_path+"/model") |
| 514 | |
| 515 | return TFInstance(sess, saver, load_path) |
| 516 | |
| 517 | def SaveModel(instance, save_path=""): |
| 518 | if len(instance.save_path)>0: |