未验证 提交 4e26fa57 编写于 作者: L Leo Chen 提交者: GitHub

fix 'invalid escape sequence' (#39842)

* fix 'invalid escape sequence'

* fix assert error
上级 7a7a7cad
......@@ -426,7 +426,7 @@ class CostModel(object):
return merged_node_id, merged_node
def merge_linear(self):
'''
r'''
This method does the following:
If X depends on Y only, they must be run sequentially.
[ e.g. A ->- C ->- D D and E depends on C only.]
......@@ -442,7 +442,7 @@ class CostModel(object):
return cnt
def merge_branch(self):
'''
r'''
This method does the following:
If a node has more than one successor, there is *branch*.
[ e.g. A ->- B ->- D ]
......
......@@ -46,7 +46,7 @@ def fused_feedforward(x,
training=True,
mode='upscale_in_train',
name=None):
"""
r"""
This is a fusion operator to compute feed forward layer in transformer model architecture.
This operator only supports running on GPU. The function of the operator is consistent with
the following pseudo code:
......@@ -230,7 +230,7 @@ def fused_multi_head_attention(x,
training=True,
mode='upscale_in_train',
name=None):
"""
r"""
Attention mapps queries and a set of key-value pairs to outputs, and
Multi-Head Attention performs multiple parallel attention to jointly attending
to information from different representation subspaces. This API only
......
......@@ -1113,7 +1113,7 @@ def margin_cross_entropy(logits,
group=None,
return_softmax=False,
reduction='mean'):
"""
r"""
.. math::
L=-\\frac{1}{N}\sum^N_{i=1}\log\\frac{e^{s(cos(m_{1}\\theta_{y_i}+m_{2})-m_{3})}}{e^{s(cos(m_{1}\\theta_{y_i}+m_{2})-m_{3})}+\sum^n_{j=1,j\\neq y_i} e^{scos\\theta_{y_i}}}
......
......@@ -670,7 +670,7 @@ def max_unpool1d(x,
data_format="NCL",
output_size=None,
name=None):
"""
r"""
This API implements max unpooling 1d opereation.
`max_unpool1d` accepts the output of `max_pool1d` as input,
including the indices of the maximum value and calculate the partial inverse.
......@@ -779,7 +779,7 @@ def max_unpool2d(x,
data_format="NCHW",
output_size=None,
name=None):
"""
r"""
This API implements max unpooling 2d opereation.
See more details in :ref:`api_nn_pooling_MaxUnPool2D` .
......@@ -894,7 +894,7 @@ def max_unpool3d(x,
data_format="NCDHW",
output_size=None,
name=None):
"""
r"""
This API implements max unpooling 3d opereation.
`max_unpool3d` accepts the output of `max_pool3d` as input,
including the indices of the maximum value and calculate the partial inverse.
......
......@@ -23,7 +23,7 @@ __all__ = []
class Dirac(Initializer):
"""Initialize the 3D/4D/5D Tensor with Dirac delta function.
r"""Initialize the 3D/4D/5D Tensor with Dirac delta function.
It can reserve the feature of convolution layer input, which means that
as many channels are reserved as possible.
......
......@@ -1554,7 +1554,7 @@ class Unfold(Layer):
class Fold(Layer):
"""
r"""
This Op is used to combines an array of sliding local blocks into a large containing
tensor. also known as col2im when operated on batched 2D image tensor. Fold calculates each
......
......@@ -1131,7 +1131,7 @@ class AdaptiveMaxPool3D(Layer):
class MaxUnPool1D(Layer):
"""
r"""
This API implements max unpooling 1d opereation.
`max_unpool1d` accepts the output of `max_pool1d` as input,
......@@ -1213,7 +1213,7 @@ class MaxUnPool1D(Layer):
class MaxUnPool2D(Layer):
"""
r"""
This API implements max unpooling 2d opereation.
'max_unpool2d' accepts the output of 'max_unpool2d' as input
......@@ -1299,7 +1299,7 @@ class MaxUnPool2D(Layer):
class MaxUnPool3D(Layer):
"""
r"""
This API implements max unpooling 3d opereation.
`max_unpool3d` accepts the output of `max_pool3d` as input,
......
......@@ -243,7 +243,7 @@ def stft(x,
normalized=False,
onesided=True,
name=None):
"""
r"""
Short-time Fourier transform (STFT).
The STFT computes the discrete Fourier transforms (DFT) of short overlapping
......@@ -398,7 +398,7 @@ def istft(x,
length=None,
return_complex=False,
name=None):
"""
r"""
Inverse short-time Fourier transform (ISTFT).
Reconstruct time-domain signal from the giving complex input and window tensor when
......
......@@ -81,7 +81,7 @@ def bernoulli(x, name=None):
def poisson(x, name=None):
"""
r"""
This OP returns a tensor filled with random number from a Poisson Distribution.
.. math::
......@@ -984,7 +984,7 @@ def rand(shape, dtype=None, name=None):
def exponential_(x, lam=1.0, name=None):
"""
r"""
This inplace OP fill input Tensor ``x`` with random number from a Exponential Distribution.
``lam`` is :math:`\lambda` parameter of Exponential Distribution.
......
......@@ -949,8 +949,8 @@ def psroi_pool(x, boxes, boxes_num, output_size, spatial_scale=1.0, name=None):
if isinstance(output_size, int):
output_size = (output_size, output_size)
pooled_height, pooled_width = output_size
assert (len(x.shape) == 4,
"Input features with shape should be (N, C, H, W)")
assert len(x.shape) == 4, \
"Input features with shape should be (N, C, H, W)"
output_channels = int(x.shape[1] / (pooled_height * pooled_width))
if in_dygraph_mode():
return _C_ops.psroi_pool(x, boxes, boxes_num, "output_channels",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册