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.

PR

Just a small problem.

I can fix it online!

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.mint.baddbmm

View Source On Gitee
mindspore.mint.baddbmm(input, batch1, batch2, *, beta=1, alpha=1)[source]

The result is the sum of the input and a batch matrix-matrix product of matrices in batch1 and batch2. The formula is defined as follows:

outi=βinputi+α(batch1i@batch2i)
Parameters
  • input (Tensor) – The input Tensor. When batch1 is a (C,W,T) Tensor and batch2 is a (C,T,H) Tensor, input must be broadcastable with (C,W,H) Tensor.

  • batch1 (Tensor) – batch1 in the above formula. Must be 3-D Tensor, dtype is same as input.

  • batch2 (Tensor) – batch2 in the above formula. Must be 3-D Tensor, dtype is same as input.

Keyword Arguments
  • beta (Union[float, int], optional) – multiplier for input. Default: 1 .

  • alpha (Union[float, int], optional) – multiplier for batch1@batch2. Default: 1 .

Returns

Tensor, has the same dtype as input, shape will be (C,W,H).

Raises
  • TypeError – If the type of input, batch1, batch2 is not Tensor.

  • TypeError – If the types of input, batch1, batch2 are different.

  • ValueError – If batch1 and batch2 are not 3-D tensors.

Supported Platforms:

Ascend

Examples

>>> import numpy as np
>>> from mindspore import Tensor, mint
>>> input = Tensor(np.ones([1, 3, 3]).astype(np.float32))
>>> batch1 = Tensor(np.ones([1, 3, 4]).astype(np.float32))
>>> batch2 = Tensor(np.ones([1, 4, 3]).astype(np.float32))
>>> output = mint.baddbmm(input, batch1, batch2)
>>> print(output)
[[[5. 5. 5.]
  [5. 5. 5.]
  [5. 5. 5.]]]