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

本文主要介绍"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()方法怎么使用" 就介绍到这。希望大家多多支持编程宝库

Kafka是怎么保证分区有序的:本文主要介绍"Kafka是如何保证分区有序的",希望能够解决您遇到有关问题,下面我们一起来看这篇 "Kafka是如何保证分区有序的" 文章。Kafka能做到全局有序吗?Kafka只能保证分区有序, 如果只有一 ...