提交 8cfed4a1 编写于 作者: M Megvii Engine Team

refactor(functional/nn): remove nn.svd

GitOrigin-RevId: 4f58e10a1fed040c03cd466eae5f65e8d78f5630
上级 e6b06914
......@@ -63,7 +63,6 @@ __all__ = [
"prelu",
"softmax",
"softplus",
"svd",
"sync_batch_norm",
"conv1d",
"sigmoid",
......@@ -1222,37 +1221,6 @@ def dot(inp1: Tensor, inp2: Tensor) -> Tensor:
return result
def svd(inp: Tensor, full_matrices=False, compute_uv=True) -> Tensor:
"""
Computes the singular value decompositions of input matrix.
:param inp: input matrix, must has shape `[..., M, N]`.
:return: output matrices, `(U, sigma, V)`.
Examples:
.. testcode::
import numpy as np
from megengine import tensor
import megengine.functional as F
x = tensor(np.arange(0, 6, dtype=np.float32).reshape(2,3))
_, y, _ = F.svd(x)
print(y.numpy().round(decimals=3))
Outputs:
.. testoutput::
[7.348 1. ]
"""
op = builtin.SVD(full_matrices=full_matrices, compute_uv=compute_uv)
U, sigma, V = apply(op, inp)
return U, sigma, V
def dropout(inp: Tensor, drop_prob: float, training: bool = True) -> Tensor:
"""
Returns a new tensor where each of the elements are randomly set to zero
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册