提交 ce716f9c 编写于 作者: J jiangjiajun

add codes

上级 43330c1a
...@@ -15,7 +15,21 @@ ...@@ -15,7 +15,21 @@
class Emitter(object): class Emitter(object):
def __init__(self): def __init__(self):
print("Nothing done") self.paddle_codes = ""
self.tab = " "
def add_codes(self, codes, indent=0):
if isinstance(codes, list):
for code in codes:
self.paddle_codes += (self.tab * indent + code + '\n')
elif isinstance(codes, str):
self.paddle_codes += (self.tab * indent + codes + '\n')
else:
raise Exception("Unknown type of codes")
def add_heads(self):
self.add_codes("import paddle.fluid as fluid")
self.add_codes("")
def save_inference_model(self): def save_inference_model(self):
print("Not Implement") print("Not Implement")
......
...@@ -17,4 +17,4 @@ from x2paddle.core.emitter import Emitter ...@@ -17,4 +17,4 @@ from x2paddle.core.emitter import Emitter
class TFEmitter(Emitter): class TFEmitter(Emitter):
def __init__(self): def __init__(self):
super(TFEmitter, self super(TFEmitter, self).__init__()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册