您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
26 行
783 B
26 行
783 B
import os
|
|
import tempfile
|
|
|
|
import mlagents.trainers.tf.tensorflow_to_barracuda as tf2bc
|
|
|
|
|
|
def test_barracuda_converter():
|
|
path_prefix = os.path.dirname(os.path.abspath(__file__))
|
|
tmpfile = os.path.join(
|
|
tempfile._get_default_tempdir(), next(tempfile._get_candidate_names()) + ".nn"
|
|
)
|
|
|
|
# make sure there are no left-over files
|
|
if os.path.isfile(tmpfile):
|
|
os.remove(tmpfile)
|
|
|
|
tf2bc.convert(path_prefix + "/BasicLearning.pb", tmpfile)
|
|
|
|
# test if file exists after conversion
|
|
assert os.path.isfile(tmpfile)
|
|
# currently converter produces small output file even if input file is empty
|
|
# 100 bytes is high enough to prove that conversion was successful
|
|
assert os.path.getsize(tmpfile) > 100
|
|
|
|
# cleanup
|
|
os.remove(tmpfile)
|