mindspore/docs/api/api_python/ops/mindspore.ops.func_depend.rst

21 lines
862 B
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.depend
====================
.. py:function:: mindspore.ops.depend(value, expr)
用来处理操作间的依赖关系。
在大多数情况下如果操作有作用在IO或内存上的副作用它们将按照用户的指令依序执行。在某些情况下如果两个操作A和B没有顺序上的依赖性而A必须在B之前执行我们建议使用Depend来指定它们的执行顺序。使用方法如下
.. code-block::
a = A(x) ---> a = A(x)
b = B(y) ---> y = depend(y, a)
---> b = B(y)
参数:
- **value** (Tensor) - 应被Depend操作符返回的Tensor。
- **expr** (Expression) - 应被执行的无输出的表达式。
返回:
Tensor作为 `value` 传入的变量。