未验证 提交 87ce94f7 编写于 作者: L liufengwei0103 提交者: GitHub

Fix bug scalar (#5950)

* fix bug scalar

* add test
Co-authored-by: Noneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
上级 43be27aa
......@@ -133,7 +133,7 @@ class _Formatter(object):
def _scalar_str(self, formatter1):
return formatter1.format(self.tolist())
return formatter1.format(_try_convert_to_local_tensor(self).tolist())
def _vector_str(self, indent, summarize, formatter1):
......
......@@ -109,6 +109,7 @@ def _test_consistent_tensor_str(test_case, device):
x = flow.ones((10, 10), placement=placement, sbp=[flow.sbp.partial_sum])
tensor_str = str(x)
test_case.assertTrue("1." in tensor_str)
test_case.assertTrue("1." in str(x[0][0]))
# summarized consistent tensor
x = flow.ones((100, 100), placement=placement, sbp=[flow.sbp.split(0)])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册