未验证 提交 532e4bbf 编写于 作者: L LielinJiang 提交者: GitHub

fix docs (#28683)

上级 db2e6cee
......@@ -211,7 +211,7 @@ def conv1d(x,
[[0, 3, 4],
[2, 9, 7],
[5, 6, 8]]]).astype(np.float32)
paddle.disable_static()
x_var = paddle.to_tensor(x)
w_var = paddle.to_tensor(w)
y_var = F.conv1d(x_var, w_var)
......@@ -673,7 +673,6 @@ def conv1d_transpose(x,
import paddle.nn.functional as F
import numpy as np
paddle.disable_static()
# shape: (1, 2, 4)
x=np.array([[[4, 0, 9, 7],
[8, 0, 9, 2,]]]).astype(np.float32)
......
......@@ -895,8 +895,6 @@ def kl_div(input, label, reduction='mean', name=None):
import numpy as np
import paddle.nn.functional as F
paddle.disable_static()
shape = (5, 20)
input = np.random.uniform(-10, 10, shape).astype('float32')
target = np.random.uniform(-10, 10, shape).astype('float32')
......
......@@ -773,8 +773,6 @@ class KLDivLoss(fluid.dygraph.Layer):
import numpy as np
import paddle.nn as nn
paddle.disable_static()
shape = (5, 20)
x = np.random.uniform(-10, 10, shape).astype('float32')
target = np.random.uniform(-10, 10, shape).astype('float32')
......
......@@ -123,7 +123,7 @@ def get_weights_path_from_url(url, md5sum=None):
Examples:
.. code-block:: python
from paddle.incubate.hapi.download import get_weights_path_from_url
from paddle.utils.download import get_weights_path_from_url
resnet18_pretrained_weight_url = 'https://paddle-hapi.bj.bcebos.com/models/resnet18.pdparams'
local_weight_path = get_weights_path_from_url(resnet18_pretrained_weight_url)
......
......@@ -306,7 +306,7 @@ class ImageFolder(Dataset):
index (int): Index
Returns:
tuple: (sample, target) where target is class_index of the target class.
sample of specific index.
"""
path = self.samples[index]
sample = self.loader(path)
......
......@@ -39,7 +39,7 @@ from . import functional_tensor as F_t
__all__ = [
'to_tensor', 'hflip', 'vflip', 'resize', 'pad', 'rotate', 'to_grayscale',
'crop', 'center_crop', 'adjust_brightness', 'adjust_contrast', 'adjust_hue',
'to_grayscale', 'normalize'
'normalize'
]
......@@ -283,13 +283,11 @@ def center_crop(img, output_size):
return F_cv2.center_crop(img, output_size)
def hflip(img, backend='pil'):
def hflip(img):
"""Horizontally flips the given Image or np.array.
Args:
img (PIL.Image|np.array): Image to be flipped.
backend (str, optional): The image proccess backend type. Options are `pil`,
`cv2`. Default: 'pil'.
Returns:
PIL.Image or np.array: Horizontall flipped image.
......@@ -576,8 +574,6 @@ def to_grayscale(img, num_output_channels=1):
Args:
img (PIL.Image|np.array): Image to be converted to grayscale.
backend (str, optional): The image proccess backend type. Options are `pil`,
`cv2`. Default: 'pil'.
Returns:
PIL.Image or np.array: Grayscale version of the image.
......@@ -624,7 +620,7 @@ def normalize(img, mean, std, data_format='CHW', to_rgb=False):
this option will be igored. Default: False.
Returns:
Tensor: Normalized mage. Data format is same as input img.
np.ndarray or Tensor: Normalized mage. Data format is same as input img.
Examples:
.. code-block:: python
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册