提交 0b06e315 编写于 作者: Q qingqing01 提交者: GitHub

Fix string format in transform (#3771)

上级 0ea122f0
......@@ -67,7 +67,7 @@ def build_mapper(ops, context=None):
"invalid operator when build ops"
o = op
op_funcs.append(o)
op_repr.append('{{}}'.format(str(o)))
op_repr.append('{{{}}}'.format(str(o)))
op_repr = '[{}]'.format(','.join(op_repr))
def _mapper(sample):
......@@ -78,7 +78,8 @@ def build_mapper(ops, context=None):
sample = out
except Exception as e:
stack_info = traceback.format_exc()
logger.warn("fail to map op [{}] with error: {} and stack:\n{}".format(f, e, str(stack_info)))
logger.warn("fail to map op [{}] with error: {} and stack:\n{}".
format(f, e, str(stack_info)))
raise e
return out
......@@ -116,10 +117,8 @@ def batch(ds, batchsize, drop_last=False, drop_empty=True):
a batched dataset
"""
return BatchedDataset(ds,
batchsize,
drop_last=drop_last,
drop_empty=drop_empty)
return BatchedDataset(
ds, batchsize, drop_last=drop_last, drop_empty=drop_empty)
def batch_map(ds, config):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册