提交 d7621aea 编写于 作者: W wjj19950828

fixed inf bug

上级 ae4db404
...@@ -261,6 +261,8 @@ class OpSet9(): ...@@ -261,6 +261,8 @@ class OpSet9():
shape = node.out_shapes[0] shape = node.out_shapes[0]
if hasattr(node.weight, "shape") and len(node.weight.shape) == 0: if hasattr(node.weight, "shape") and len(node.weight.shape) == 0:
if node.weight == float('inf') or node.weight == float('-inf'):
node.weight = string(node.weight)
self.paddle_graph.add_layer( self.paddle_graph.add_layer(
"paddle.full", "paddle.full",
inputs={}, inputs={},
...@@ -797,6 +799,8 @@ class OpSet9(): ...@@ -797,6 +799,8 @@ class OpSet9():
if len(value) == 1: if len(value) == 1:
value = value.tolist() value = value.tolist()
value = value[0] value = value[0]
if value == float('inf') or value == float('-inf'):
value = string(value)
self.paddle_graph.add_layer( self.paddle_graph.add_layer(
"paddle.full", "paddle.full",
inputs={}, inputs={},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册