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.

mindsponge.metrics.frame_aligned_point_error

View Source On Gitee
mindsponge.metrics.frame_aligned_point_error(pred_frames, target_frames, frames_mask, pred_positions, target_positions, positions_mask, length_scale, l1_clamp_distance)[source]

Measure point error under different alignments which computes error between two structures with B points under A alignments derived from the given pairs of frames. Jumper et al. (2021) Suppl. Alg. 28 “computeFAPE”. This function considers all frames. First transform the predicted atom positions to different predicted local frames, xj_predi=Ti_predxj_pred Then transform the true atom positions to different true local frames, xj_gti=Ti_gtxj_gt Then compute the L2 error of all atoms positions in all local frames. iNframesjNatoms(xj_predixj_gti)

Parameters
  • pred_frames (Tensor) – The predicted frames of shape (12,Nframes) with Nframes the number of pairs of frames. For the first dimension, the first 9 elements are the 9 components of rotation matrix; the last 3 elements are the 3 component of translation matrix.

  • target_frames (Tensor) – The ground truth frames of same shape as pred_frames.

  • frames_mask (Tensor) – The binary mask for frames of shape (Nframes,).

  • pred_positions (Tensor) – The predicted atom positions tensor of shape (3,Natoms) with Natoms the number of atoms.

  • target_positions (Tensor) – The ground truth atom positions of same shape as pred_positions.

  • positions_mask (Tensor) – The binary mask for atom positions of shape (Natoms,).

  • length_scale (float) – The unit distance which is used to scale distances.

  • l1_clamp_distance (float) – Distance cutoff on error beyond which gradients will be zero.

Returns

  • error_clamp (Tensor) - Backbone FAPE loss clamped with shape (Nrecycle,).

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> np.random.seed(0)
>>> from mindsponge.metrics import frame_aligned_point_error
>>> from mindspore import dtype as mstype
>>> from mindspore import Tensor
>>> pred_frames = Tensor(np.random.rand(12, 256)).astype(mstype.float32)
>>> target_frames = Tensor(np.random.rand(12, 256)).astype(mstype.float32)
>>> frames_mask = Tensor(np.random.rand(256,)).astype(mstype.float32)
>>> pred_positions = Tensor(np.random.rand(3, 1024)).astype(mstype.float32)
>>> target_positions = Tensor(np.random.rand(3, 1024)).astype(mstype.float32)
>>> positions_mask = Tensor(np.random.rand(1024,)).astype(mstype.float32)
>>> length_scale = 10.0
>>> l1_clamp_distance = 10.0
>>> fape = frame_aligned_point_error(pred_frames, target_frames, frames_mask,
>>>                                  pred_positions, target_positions, positions_mask,
>>>                                  length_scale, l1_clamp_distance)
>>> print(fape)
0.08747593