Browse Source

refactor(functional/nn): remove nn.svd

GitOrigin-RevId: 4f58e10a1f
tags/v1.3.0
Megvii Engine Team 4 years ago
parent
commit
8cfed4a1cb
1 changed files with 0 additions and 32 deletions
  1. +0
    -32
      imperative/python/megengine/functional/nn.py

+ 0
- 32
imperative/python/megengine/functional/nn.py View File

@@ -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


Loading…
Cancel
Save