未验证 提交 84f88c1c 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix python example: grid_sampler, kldiv_loss, spectral_norm (#1754)

上级 949e5201
......@@ -62,6 +62,8 @@ step 2:
.. code-block:: python
import paddle.fluid as fluid
# 一般与 affine_grid 组合使用
x = fluid.data(name='x', shape=[None, 10, 32, 32], dtype='float32')
theta = fluid.layers.data(name='theta', shape=[2, 3], dtype='float32')
......
......@@ -34,10 +34,12 @@ kL发散损失计算如下:
返回类型:变量(Variable),数据类型与输入 ``x`` 一致。
**代码示例**:
**代码示例:**
.. code-block:: python
import paddle.fluid as fluid
# 'batchmean' reduction, loss shape 为[N]
x = fluid.data(name='x', shape=[None,4,2,2], dtype='float32') # shape=[-1, 4, 2, 2]
target = fluid.layers.data(name='target', shape=[4,2,2], dtype='float32')
......
......@@ -37,10 +37,12 @@ spectral_norm
返回类型:变量(Variable),数据类型与输入 ``weight`` 一致。
**代码示例**:
**代码示例:**
.. code-block:: python
import paddle.fluid as fluid
weight = fluid.data(name='weight', shape=[2, 8, 32, 32], dtype='float32')
x = fluid.layers.spectral_norm(weight=weight, dim=1, power_iters=2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册