Pinverse
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_pinverse.Rd
Pinverse
Arguments
- self
(Tensor) The input tensor of size \((*, m, n)\) where \(*\) is zero or more batch dimensions
- rcond
(float) A floating point value to determine the cutoff for small singular values. Default: 1e-15
Note
This method is implemented using the Singular Value Decomposition.
-inverse is not necessarily a continuous function in the elements of the matrix `[1]`_.
The pseudofor a constant rank only `[2]`_.
Therefore, derivatives are not always existent, and exist -able due to the implementation by using SVD results, and
However, this method is backprop-backward will also be unstable due to the usage of SVD internally.
could be unstable. Double`~torch.svd` for more details. See
pinverse(input, rcond=1e-15) -> Tensor
Calculates the pseudo-inverse (also known as the Moore-Penrose inverse) of a 2D tensor.
Please look at Moore-Penrose inverse
_ for more details
Examples
if (torch_is_installed()) {
input = torch_randn(c(3, 5))
input
torch_pinverse(input)
# Batched pinverse example
a = torch_randn(c(2,6,3))
b = torch_pinverse(a)
torch_matmul(b, a)
}
#> torch_tensor
#> (1,.,.) =
#> 1.0000e+00 -2.0489e-07 -5.9605e-08
#> 2.3842e-07 1.0000e+00 1.9372e-07
#> 8.9407e-08 3.7253e-08 1.0000e+00
#>
#> (2,.,.) =
#> 1.0000e+00 1.1176e-07 8.1956e-08
#> 1.6019e-07 1.0000e+00 -4.6939e-07
#> -1.1548e-07 -1.6391e-07 1.0000e+00
#> [ CPUFloatType{2,3,3} ]