From 9e5db04de3f8959141562f47bb6765cb801f386b Mon Sep 17 00:00:00 2001 From: ZPaC Date: Thu, 19 Jan 2023 10:06:56 +0800 Subject: [PATCH] Update 'place' doc --- mindspore/python/mindspore/nn/cell.py | 4 +++- mindspore/python/mindspore/ops/primitive.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mindspore/python/mindspore/nn/cell.py b/mindspore/python/mindspore/nn/cell.py index 35b18ce316d..359133a14ef 100755 --- a/mindspore/python/mindspore/nn/cell.py +++ b/mindspore/python/mindspore/nn/cell.py @@ -2137,8 +2137,10 @@ class Cell(Cell_): The rank is unique in processes with the same role. Examples: + >>> from mindspore import context >>> import mindspore.nn as nn - >>> fc = nn.Dense() + >>> context.set_context(mode=context.GRAPH_MODE) + >>> fc = nn.Dense(2, 3) >>> fc.place('MS_WORKER', 0) """ all_ops = self._get_prims_recursively() diff --git a/mindspore/python/mindspore/ops/primitive.py b/mindspore/python/mindspore/ops/primitive.py index bc46d30f309..7209fbd580a 100644 --- a/mindspore/python/mindspore/ops/primitive.py +++ b/mindspore/python/mindspore/ops/primitive.py @@ -426,7 +426,9 @@ class Primitive(Primitive_): The rank_id is unique in processes with the same role. Examples: + >>> from mindspore import context >>> import mindspore.ops as ops + >>> context.set_context(mode=context.GRAPH_MODE) >>> matmul = ops.MatMul() >>> matmul.place('MS_WORKER', 0) """