Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.nn.LPPool1d

class mindspore.nn.LPPool1d(norm_type, kernel_size, stride=None, ceil_mode=False)[source]

Applying 1D LPPooling operation on an input Tensor can be regarded as forming a 1D input plane.

Typically the input is of shape (Nin,Cin,Lin) or (Cin,Lin), the output is of shape (Nout,Cout,Lout) or (Cout,Lout), with the same shape as input, the operation is as follows.

f(X)=xXxpp
Parameters
  • norm_type (Union[int, float]) –

    Type of normalization, represents p in the formula, can not be 0.

    • if p = 1, the result is the sum of the elements within the pooling kernel(proportional to average pooling).

    • if p = , the result is the result of maximum pooling.

  • kernel_size (int) – The size of kernel window.

  • stride (int) – The distance of kernel moving, an int number that represents the width of movement is stride. If the value is None, the default value kernel_size is used. Default: None.

  • ceil_mode (bool) – Whether to use ceil or floor to calculate output shape. Default: False.

Inputs:
  • x (Tensor) - Tensor of shape (Nin,Cin,Lin) or (Cin,Lin).

Outputs:
  • output (Tensor) - LPPool1d result, with shape (Nout,Cout,Lout) or (Cout,Lout), it has the same data type as x, where

Lout=Linkernel_sizestride+1
Raises
  • TypeError – If x is not an Tensor.

  • TypeError – If kernel_size or stride is not an int.

  • TypeError – If ceil_mode is not a bool.

  • TypeError – If norm_type is neither float nor int.

  • ValueError – If norm_type is equal to 0.

  • ValueError – If kernel_size or stride is less than 1.

  • ValueError – If length of shape of x is not equal to 2 or 3.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore as ms
>>> import mindspore.nn as nn
>>> from mindspore import Tensor
>>> import numpy as np
>>> a = Tensor(np.arange(2 * 3 * 4).reshape((2, 3, 4)), dtype=ms.float32)
>>> net = nn.LPPool1d(norm_type=1, kernel_size=3, stride=1)
>>> out = net(a)
>>> print(out)
[[[ 3.  6.]
  [15. 18.]
  [27. 30.]]
 [[39. 42.]
  [51. 54.]
  [63. 66.]]]