MCPcopy Create free account
hub / github.com/modelscope/modelscope / __init__

Method __init__

modelscope/models/science/unifold/modules/frame.py:185–212  ·  view source on GitHub ↗
(
        self,
        rotation: Optional[Rotation],
        translation: Optional[torch.Tensor],
    )

Source from the content-addressed store, hash-verified

183class Frame:
184
185 def __init__(
186 self,
187 rotation: Optional[Rotation],
188 translation: Optional[torch.Tensor],
189 ):
190 if rotation is None and translation is None:
191 rotation = Rotation.identity((0, ))
192 translation = zero_translation((0, ))
193 elif translation is None:
194 translation = zero_translation(rotation.shape, rotation.dtype,
195 rotation.device,
196 rotation.requires_grad)
197
198 elif rotation is None:
199 rotation = Rotation.identity(
200 translation.shape[:-1],
201 translation.dtype,
202 translation.device,
203 translation.requires_grad,
204 )
205
206 if (rotation.shape != translation.shape[:-1]) or (rotation.device
207 != # noqa W504
208 translation.device):
209 raise ValueError('RotationMatrix and translation incompatible')
210
211 self._r = rotation
212 self._t = translation
213
214 @staticmethod
215 def identity(

Callers

nothing calls this directly

Calls 2

zero_translationFunction · 0.85
identityMethod · 0.45

Tested by

no test coverage detected