@@ -6385,6 +6385,7 @@ def expand(x, expand_times, name=None):
6385
6385
from paddle .fluid .framework import convert_np_dtype_to_dtype_
6386
6386
6387
6387
6388
+ @templatedoc ()
6388
6389
def uniform_random_batch_size_like (input ,
6389
6390
shape ,
6390
6391
dtype = 'float32' ,
@@ -6394,22 +6395,19 @@ def uniform_random_batch_size_like(input,
6394
6395
max = 1.0 ,
6395
6396
seed = 0 ):
6396
6397
"""
6397
- UniformRandomBatchSizeLike operator.
6398
- This operator initializes a tensor with the same batch_size as the Input tensor with random values sampled from a uniform distribution.
6399
-
6398
+ ${comment}
6400
6399
6401
6400
Args:
6402
- input (Variable): Tensor whose input_dim_idx'th dimension specifies the batch_size.
6403
- shape (tuple|list): the shape of the output.
6404
- input_dim_idx (Int): The index of input's batch size dimension.
6405
- output_dim_idx (Int): The index of output's batch size dimension.
6406
- min (Float): Minimum value of uniform random.
6407
- max (Float): Maximum value of uniform random.
6408
- seed (Int): Random seed used for generating samples. 0 means use a seed generated by the system.
6409
- Note that if seed is not 0, this operator will always generate the same random numbers every time.
6401
+ input (Variable): ${input_comment}
6402
+ shape (tuple|list): ${shape_comment}
6403
+ input_dim_idx (Int): ${input_dim_idx_comment}
6404
+ output_dim_idx (Int): ${output_dim_idx}
6405
+ min (Float): ${min_comment}
6406
+ max (Float): ${max_comment}
6407
+ seed (Int): ${seed_comment}
6410
6408
dtype(np.dtype|core.VarDesc.VarType|str): The type of data : float32, float_16, int etc
6411
6409
Returns:
6412
- out (Variable): Output of this operator.
6410
+ out (Variable): ${out_comment}
6413
6411
6414
6412
"""
6415
6413
@@ -6433,28 +6431,26 @@ def uniform_random_batch_size_like(input,
6433
6431
return out
6434
6432
6435
6433
6434
+ @templatedoc ()
6436
6435
def gaussian_random (shape ,
6437
6436
mean = 0.0 ,
6438
6437
std = 1.0 ,
6439
6438
seed = 0 ,
6440
6439
dtype = 'float32' ,
6441
6440
use_mkldnn = False ):
6442
6441
"""
6443
- GaussianRandom Operator.
6444
-
6445
- Used to initialize tensors with gaussian random generator.
6442
+ ${comment}
6446
6443
6447
6444
Args:
6448
- shape (tuple|list): The dimension of random tensor.
6449
- mean (Float): Mean of random tensor.
6450
- std (Float): Std of random tensor.
6451
- seed (Int): Random seed of generator.0 means use system wide seed.
6452
- Note that if seed is not 0, this operator will always generate the same random numbers every time.
6445
+ shape (tuple|list): ${shape_comment}
6446
+ mean (Float): ${mean_comment}
6447
+ std (Float): ${std_comment}
6448
+ seed (Int): ${seed_comment}
6453
6449
dtype(np.dtype|core.VarDesc.VarType|str): Output data type.
6454
6450
use_mkldnn (Bool): Only used in mkldnn kernel.
6455
6451
6456
6452
Returns:
6457
- out (Variable): Output of this operator.
6453
+ out (Variable): ${out_comment}
6458
6454
6459
6455
"""
6460
6456
@@ -6476,23 +6472,20 @@ def gaussian_random(shape,
6476
6472
return out
6477
6473
6478
6474
6475
+ @templatedoc ()
6479
6476
def sampling_id (x , min = 0.0 , max = 1.0 , seed = 0 , dtype = 'float32' ):
6480
6477
"""
6481
- SamplingId Operator.
6482
-
6483
- A layer for sampling id from multinomial distribution from the input.
6484
- Sampling one id for one sample.
6478
+ ${comment}
6485
6479
6486
6480
Args:
6487
- x (Variable): The input tensor of softmax. 2-D with shape [batch_size, input_feature_dimensions].
6488
- min (Float): Minimum value of random.
6489
- max (Float): Maximun value of random.
6490
- seed (Float): random seed used for the random number engine.0 means use a seed generated by the system.
6491
- Note that if seed is not 0, this operator will always generate the same random numbers every time.
6481
+ x (Variable): ${x_comment}
6482
+ min (Float): ${min_comment}
6483
+ max (Float): ${max_comment}
6484
+ seed (Float): ${seed_comment}
6492
6485
dtype(np.dtype|core.VarDesc.VarType|str): The type of output data : float32, float_16, int etc
6493
6486
6494
6487
Returns:
6495
- out (Variable): Output of this operator.
6488
+ out (Variable): ${out_comment}
6496
6489
6497
6490
"""
6498
6491
@@ -6509,6 +6502,7 @@ def sampling_id(x, min=0.0, max=1.0, seed=0, dtype='float32'):
6509
6502
return out
6510
6503
6511
6504
6505
+ @templatedoc ()
6512
6506
def gaussian_random_batch_size_like (input ,
6513
6507
shape ,
6514
6508
input_dim_idx = 0 ,
@@ -6518,20 +6512,20 @@ def gaussian_random_batch_size_like(input,
6518
6512
seed = 0 ,
6519
6513
dtype = 'float32' ):
6520
6514
"""
6521
- Used to initialize tensors with gaussian random generator. The defalut mean of the distribution is 0. and defalut standard deviation (std) of the distribution is 1.. Uers can set mean and std by input arguments.
6515
+ ${comment}
6522
6516
6523
6517
Args:
6524
- input (Variable): Tensor whose input_dim_idx'th dimension specifies the batch_size.
6525
- shape (tuple|list): the shape of the output.
6526
- input_dim_idx (Int): The index of input's batch size dimension
6527
- output_dim_idx (Int): The index of output's batch size dimension
6528
- mean (Float): The mean (or center) of the gaussian distribution.
6529
- std (Float): The standard deviation (std, or spread) of the gaussian distribution.
6530
- seed (Int): Random seed of generator.0 means use system wide seed._note that if seed is not 0, this operator will always generate the same random numbers every time.
6518
+ input (Variable): ${input_comment}
6519
+ shape (tuple|list): ${shape_comment}
6520
+ input_dim_idx (Int): ${input_dim_idx}
6521
+ output_dim_idx (Int): ${output_dim_idx_comment}
6522
+ mean (Float): ${mean_comment}
6523
+ std (Float): ${std_comment}
6524
+ seed (Int): ${seed_comment}
6531
6525
dtype(np.dtype|core.VarDesc.VarType|str): The type of output data : float32, float_16, int etc
6532
6526
6533
6527
Returns:
6534
- out (Variable): Output of this operator
6528
+ out (Variable): ${out_comment}
6535
6529
"""
6536
6530
6537
6531
helper = LayerHelper ('gaussian_random_batch_size_like' , ** locals ())
@@ -6554,19 +6548,17 @@ def gaussian_random_batch_size_like(input,
6554
6548
return out
6555
6549
6556
6550
6551
+ @templatedoc ()
6557
6552
def sum (x , use_mkldnn = False ):
6558
6553
"""
6559
- Sum operator.
6560
- This operators sums the input tensors. All the inputs can carry
6561
- the LoD (Level of Details) information. However, the output only
6562
- shares the LoD information with the first input.
6554
+ ${comment}
6563
6555
6564
6556
Args:
6565
- x (Variable): The input tensors of sum operator.
6566
- use_mkldnn (Bool): Only used in mkldnn kernel
6557
+ x (Variable): ${x_comment}
6558
+ use_mkldnn (Bool): ${use_mkldnn_comment}
6567
6559
6568
6560
Returns:
6569
- out (Variable): Output of this operator
6561
+ out (Variable): ${out_comment}
6570
6562
6571
6563
"""
6572
6564
@@ -6581,49 +6573,19 @@ def sum(x, use_mkldnn=False):
6581
6573
return out
6582
6574
6583
6575
6576
+ @templatedoc ()
6584
6577
def slice (input , axes , starts , ends ):
6585
6578
"""
6586
- Slice Operator.
6587
-
6588
- Produces a slice of the input tensor along multiple axes. Similar to numpy:
6589
- https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
6590
- Slice uses `axes`, `starts` and `ends` attributes to specify the start and
6591
- end dimension for each axis in the list of axes, it uses this information
6592
- to slice the input data tensor. If a negative value is passed for any of
6593
- the start or end indices, it represents number of elements before the end
6594
- of that dimension. If the value passed to start or end is larger than
6595
- the n (the number of elements in this dimension), it represents n.
6596
- For slicing to the end of a dimension with unknown size, it is recommended
6597
- to pass in INT_MAX. If axes are omitted, they are set to [0, ..., ndim-1].
6598
- Following examples will explain how slice works:
6599
-
6600
- .. code-block:: text
6601
-
6602
- Cast1:
6603
- Given:
6604
- data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
6605
- axes = [0, 1]
6606
- starts = [1, 0]
6607
- ends = [2, 3]
6608
- Then:
6609
- result = [ [5, 6, 7], ]
6610
-
6611
- Cast2:
6612
- Given:
6613
- data = [ [1, 2, 3, 4], [5, 6, 7, 8], ]
6614
- starts = [0, 1]
6615
- ends = [-1, 1000]
6616
- Then:
6617
- result = [ [2, 3, 4], ]
6579
+ ${comment}
6618
6580
6619
6581
Args:
6620
- input (Variable): Tensor of data to extract slices from .
6621
- axes (List): Axes that `starts` and `ends` apply to. It's optional._if not present, will be treated as [0, 1, ..., len(`starts`) - 1].
6622
- starts (List): Starting indices of corresponding axis in `axes`.
6623
- ends (List): Starting indices of corresponding axis in `axes`.
6582
+ input (Variable): ${input_comment} .
6583
+ axes (List): ${axes_comment}
6584
+ starts (List): ${starts_comment}
6585
+ ends (List): ${ends_comment}
6624
6586
6625
6587
Returns:
6626
- out (Variable): The output of this operator.
6588
+ out (Variable): ${output_comment}
6627
6589
6628
6590
"""
6629
6591
@@ -6640,16 +6602,16 @@ def slice(input, axes, starts, ends):
6640
6602
return out
6641
6603
6642
6604
6605
+ @templatedoc ()
6643
6606
def shape (input ):
6644
6607
"""
6645
- Shape Operator
6646
- Get the shape of input tensor. Only support CPU input Tensor now.
6608
+ ${comment}
6647
6609
6648
6610
Args:
6649
- input (Variable): The input tensor.
6611
+ input (Variable): ${input_comment}
6650
6612
6651
6613
Returns:
6652
- out (Variable): The output of this operator.
6614
+ out (Variable): ${out_comment}
6653
6615
6654
6616
"""
6655
6617
0 commit comments