torch.Tensor.tolist()方法如何使用

这期内容当中小编将会给大家带来有关torch.Tensor.tolist()方法如何使用,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

torch.Tensor.tolist()方法如何使用
原文及翻译:

tolist()方法: tolist()” tolist() -> list or number
    tolist() -> 返回列表或者数字

    Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.Examples:>>> a = torch.randn(2, 2)>>> a.tolist()[[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]]>>> a[0,0].tolist()0.012766935862600803

上述就是小编为大家分享的torch.Tensor.tolist()方法如何使用了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。