pypose.randn_Sim3¶
- class pypose.randn_Sim3(*lsize, sigma=1.0, **kwargs)[source]¶
Returns
Sim3_type
LieTensor filled with the Exponential map of the randomsim3_type
LieTensor generated usingrandn_sim3()
.\[\mathrm{data}[*, :] = \mathrm{Exp}([\tau_x, \tau_y, \tau_z, \delta_x, \delta_y, \delta_z, \log s]), \]where translation \([\tau_x, \tau_y, \tau_z]\) is generated from a normal distribution \(\mathcal{N}(0, \sigma_t)\), rotation \([\delta_x, \delta_y, \delta_z]\) is generated using
pypose.randn_so3()
with with standard deviation \(\sigma_r\), scale \(\log s\) is generated from a normal distribution \(\mathcal{N}(0, \sigma_s)\), and \(\mathrm{Exp}()\) is the Exponential map. Note that standard deviations \(\sigma_t\), \(\sigma_r\), and \(\sigma_s\) are specified bysigma
(\(\sigma\)), where \(\sigma = (\sigma_t, \sigma_r, \sigma_s)\).For detailed explanation, please see
pypose.randn_sim3()
andpypose.Exp()
.- Parameters
lsize (int...) – a sequence of integers defining the lshape of the output tensor. Can be a variable number of arguments or a collection like a list or tuple.
sigma (float or (float...), optional) – standard deviation (\(\sigma_t\), \(\sigma_r\), and \(\sigma_s\)) for the three normal distribution. Default:
1.0
.requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default:
False
.generator (torch.Generator, optional) – a pseudorandom number generator for sampling
dtype (torch.dtype, optional) – the desired data type of returned tensor. Default:
None
. IfNone
, uses a global default (seetorch.set_default_tensor_type()
).layout (torch.layout, optional) – the desired layout of returned Tensor. Default:
torch.strided
.device (torch.device, optional) – the desired device of returned tensor. Default:
None
. IfNone
, uses the current device for the default tensor type (seetorch.set_default_tensor_type()
). Device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types.
- Returns
a
Sim_type
LieTensor- Return type
Note
The parameter \(\sigma\) can either be:
a single
float
– in which all the elements in theSim3_type
share the same sigma, i.e., \(\sigma_{\rm{t}}\) = \(\sigma_{\rm{r}}\) = \(\sigma_{\rm{s}}\) = \(\sigma\).a
tuple
of three floats – in which case, the specific sigmas for the three parts are assigned independently, i.e., \(\sigma\) = (\(\sigma_{\rm{t}}\), \(\sigma_{\rm{r}}\), \(\sigma_{\rm{s}}\)).a
tuple
of five floats – in which case, the specific sigmas for each translation data are also assigned independently, i.e., \(\sigma\) = (\(\sigma_{\rm{tx}}\), \(\sigma_{\rm{ty}}\), \(\sigma_{\rm{tz}}\), \(\sigma_{\rm{r}}\), \(\sigma_{\rm{s}}\)).
Example
For \(\sigma = (\sigma_{\rm{t}}, \sigma_{\rm{r}}, \sigma_{\rm{s}})\)
>>> pp.randn_Sim3(sigma=(1.0, 1.0, 2.0)) Sim3Type LieTensor: LieTensor([-0.7667, -0.0981, 0.8168, 0.0931, 0.0917, 0.0939, 0.9870, 0.2391])
For \(\sigma = (\sigma_{\rm{tx}}, \sigma_{\rm{ty}}, \sigma_{\rm{tz}}, \sigma_{\rm{r}}, \sigma_{\rm{s})}\)
>>> pp.randn_Sim3(2, sigma=(1.0, 1.0, 2.0, 1.0, 2.0)) Sim3Type LieTensor: tensor([[-0.0117, 0.0708, 1.6853, 0.1089, 0.4186, -0.0877, 0.8973, 0.3969], [ 0.2106, -0.0694, -0.0574, -0.2902, -0.4806, -0.0815, 0.8235, 0.0134]])