basic.py 文件源码

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

项目:PyTorch-Encoding 作者: zhanghang1989 项目源码 文件源码
def view_each(x, size):
    """Multi-GPU version torch.view

    Returns a new tensor with the same data but different size.
    The returned tensor shares the same data and must have the same number
    of elements, but may have a different size. A tensor must be
    :attr:`contiguous` to be viewed.

    Args:
        input: list of multi-gpu tensors
        size (torch.Size or int...): Desired size

    """
    y = []
    for i in range(len(x)):
        y.append(x[i].view(size))
    return y
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号