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.ops.bidense

mindspore.ops.bidense(input1, input2, weight, bias=None)[source]

Applies bilinear dense connected layer for input1 and input2. The bilinear dense function is defined as:

output=x1TAx2+b

x1 represents input1 , x2 represents input2 , A represents weight , b represents bias .

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • input1 (Tensor) – Input Tensor of shape (,in1_channels), where means any number of additional dimensions. All but the last dimension should be the same with input2.

  • input2 (Tensor) – Input Tensor of shape (,in2_channels), where means any number of additional dimensions. All but the last dimension should be the same with input1.

  • weight (Tensor) – The weight applied to the input1 and input2. The shape is (out_channels,in1_channels,in2_channels).

  • bias (Tensor, optional) – Additive biases to the output. The shape is (out_channels) or (). Defaults: None , the bias is 0.

Returns

Tensor, shape (,out_channels), where means any number of additional dimensions. All but the last dimension should be the same with the input Tensors.

Raises
  • TypeError – If input1 is not Tensor.

  • TypeError – If input2 is not Tensor.

  • TypeError – If weight is not Tensor.

  • TypeError – If bias is not Tensor.

  • ValueError – If dimensions except the last of ‘input1’ are different from ‘input2’ .

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> from mindspore import Tensor, ops
>>> input1 = mindspore.Tensor([[-1.1283, 1.2603],
...                            [0.0214, 0.7801],
...                            [-1.2086, 1.2849]], mindspore.float32)
>>> input2 = mindspore.Tensor([[-0.4631, 0.3238, 0.4201],
...                            [0.6215, -1.0910, -0.5757],
...                            [-0.7788, -0.0706, -0.7942]], mindspore.float32)
>>> weight = mindspore.Tensor([[[-0.3132, 0.9271, 1.1010],
...                             [0.6555, -1.2162, -0.2987]],
...                            [[1.0458, 0.5886, 0.2523],
...                             [-1.3486, -0.8103, -0.2080]],
...                            [[1.1685, 0.5569, -0.3987],
...                             [-0.4265, -2.6295, 0.8535]],
...                            [[0.6948, -1.1288, -0.6978],
...                             [0.3511, 0.0609, -0.1122]]], mindspore.float32)
>>> output = ops.bidense(input1, input2, weight)
>>> print(output)
[[-2.0612743 0.5581219 0.22383511 0.8667302]
 [1.4476739 0.12626505 1.6552988 0.21297503]
 [0.6003161 2.912046 0.5590313 -0.35449564]]