コード例 #1
0
ファイル: basic.py プロジェクト: k9sret/Dragon
def square(a):
    """Calculate the square of input.

    Parameters
    ----------
    a : Tensor
        The input tensor.

    Returns
    -------
    Tensor
        The square result.

    """
    return ops.Square(a)
コード例 #2
0
def square(x, name=None):
    """
    Computes square of x element-wise.

      I.e., \\(y = x * x = x^2\\).

      Args:
        x: A `Tensor`.
        name: A name for the operation (optional).

      Returns:
        A `Tensor`. Has the same type as `x`.

    """

    return ops.Square(x, name=name)
コード例 #3
0
def l2_loss(t, name=None):
    """
    Computes half the L2 norm of a tensor without the sqrt:

      output = sum(t ** 2) / 2

      Args:
        t:  A Tensor. Typically 2-D, but may have any dimensions.
        name: Optional name for the operation.

      Returns:
        A Tensor. Has the same type as t. 0-D.

    """

    return (ops.Reduce(ops.Square(t), operation='SUM') * 0.5)
コード例 #4
0
ファイル: math_ops.py プロジェクト: zhangkaij/Dragon
def square(x, name=None):

    return ops.Square(x, name=name)
コード例 #5
0
ファイル: nn_ops.py プロジェクト: k9sret/Dragon
def l2_loss(t, name=None):
    return (ops.Reduce(ops.Square(t), operation='SUM') * 0.5)