未验证 提交 9209f341 编写于 作者: A AshburnLee 提交者: GitHub

Made a change in python API to support the GPU version of unique OP working in...

Made a change in python API to support the GPU version of unique OP working in static graph (#27899)

* Made a change to support unique op working in static graph

* Correct python format error
上级 d5cc144c
...@@ -669,21 +669,24 @@ def unique(x, ...@@ -669,21 +669,24 @@ def unique(x,
} }
out = helper.create_variable_for_type_inference( out = helper.create_variable_for_type_inference(
dtype=x.dtype, stop_gradient=True) dtype=x.dtype, stop_gradient=True)
indices = helper.create_variable_for_type_inference(
dtype=attr_dtype, stop_gradient=True)
inverse = helper.create_variable_for_type_inference( inverse = helper.create_variable_for_type_inference(
dtype=attr_dtype, stop_gradient=True) dtype=attr_dtype, stop_gradient=True)
outputs = {"Out": out, "Index": inverse} counts = helper.create_variable_for_type_inference(
dtype=attr_dtype, stop_gradient=True)
outputs = {
"Out": out,
"Indices": indices,
"Index": inverse,
"Counts": counts
}
outs = [out] outs = [out]
if return_index: if return_index:
indices = helper.create_variable_for_type_inference(
dtype=attr_dtype, stop_gradient=True)
outputs["Indices"] = indices
outs.append(indices) outs.append(indices)
if return_inverse: if return_inverse:
outs.append(inverse) outs.append(inverse)
if return_counts: if return_counts:
counts = helper.create_variable_for_type_inference(
dtype=attr_dtype, stop_gradient=True)
outputs["Counts"] = counts
outs.append(counts) outs.append(counts)
helper.append_op( helper.append_op(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册