matrix.py 文件源码

python
阅读 46 收藏 0 点赞 0 评论 0

项目:paysage 作者: drckf 项目源码 文件源码
def tmin(x: T.FloatTensor,
         axis: int = None,
         keepdims: bool = False) -> T.FloatingPoint:
    """
    Return the elementwise minimum of a tensor along the specified axis.

    Args:
        x: A float or tensor.
        axis (optional): The axis for taking the minimum.
        keepdims (optional): If this is set to true, the dimension of the tensor
                             is unchanged. Otherwise, the reduced axis is removed
                             and the dimension of the array is 1 less.

    Returns:
        if axis is None:
            float: The overall minimum of the elements in the tensor
        else:
            tensor: The minimum of the tensor along the specified axis.

    """
    if axis is not None:
        return x.min(dim=axis, keepdim=keepdims)[0]
    else:
        return x.min()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号