tfg.math.interpolation.slerp.quaternion_weights
Stay organized with collections
Save and categorize content based on your preferences.
Calculates slerp weights for two normalized quaternions.
tfg.math.interpolation.slerp.quaternion_weights(
quaternion1: type_alias.TensorLike,
quaternion2: type_alias.TensorLike,
percent: Union[type_alias.Float, type_alias.TensorLike],
eps: Optional[type_alias.Float] = None,
name: str = 'quaternion_weights'
) -> Tuple[tf.Tensor, tf.Tensor]
Given a percent and two normalized quaternions, this function returns the
slerp weights. It can also produce extrapolation weights when percent is
outside of the [0, 1] range. It reduces to lerp when input quaternions are
almost parallel or anti-parallel. Input quaternions are assumed to be
normalized. The tf.graphics debug flag TFG_ADD_ASSERTS_TO_GRAPH defined
in tfg_flags.py can be set to add assertions to the graph that check whether
the inputs are normalized, and whether Inf or Nan values are produced.
Note |
In the following, A1 to An are optional batch dimensions.
|
Args |
quaternion1
|
A tensor of shape [A1, ... , An, 4] storing normalized
quaternions in its last dimension.
|
quaternion2
|
A tensor of shape [A1, ... , An, 4] storing normalized
quaternions in its last dimension.
|
percent
|
A float or a tensor with a shape broadcastable to the shape [A1,
... , An] .
|
eps
|
A float used to make operations safe. When left as None, the function
automatically picks the best epsilon based on the dtype and the operation.
|
name
|
A name for this op. Defaults to "quaternion_weights".
|
Raises |
ValueError
|
If the shapes of quaternions do not match, if the last
dimensions of quaternions are not 4, or if percent is neither a float, nor
a tensor with last dimension 1.
|
Returns |
Two tensors of shape [A1, ... , An, 1] each, which are the two slerp
weights for each quaternion.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2022-10-28 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2022-10-28 UTC."],[],[]]