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