|
|
@@ -53,7 +53,6 @@ __all__ = [ |
|
|
|
"logsigmoid", |
|
|
|
"logsumexp", |
|
|
|
"logsoftmax", |
|
|
|
"matinv", |
|
|
|
"max_pool2d", |
|
|
|
"one_hot", |
|
|
|
"prelu", |
|
|
@@ -1183,38 +1182,6 @@ def remap( |
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
def matinv(inp: Tensor) -> Tensor: |
|
|
|
""" |
|
|
|
Computes the inverse of a batch of matrices; input must has shape [..., n, n]. |
|
|
|
|
|
|
|
:param inp: input tensor. |
|
|
|
:return: output tensor. |
|
|
|
|
|
|
|
Examples: |
|
|
|
|
|
|
|
.. testcode:: |
|
|
|
|
|
|
|
import numpy as np |
|
|
|
from megengine import tensor |
|
|
|
import megengine.functional as F |
|
|
|
|
|
|
|
data = tensor([[1.0, 0.0], [1.0, 1.0]]) |
|
|
|
out = F.matinv(data) |
|
|
|
print(out.numpy()) |
|
|
|
|
|
|
|
Outputs: |
|
|
|
|
|
|
|
.. testoutput:: |
|
|
|
|
|
|
|
[[ 1. 0.] |
|
|
|
[-1. 1.]] |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
(result,) = apply(builtin.MatrixInverse(), inp) |
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
def interpolate( |
|
|
|
inp: Tensor, |
|
|
|
size: Optional[Union[int, Tuple[int, int]]] = None, |
|
|
|