*(张量元组张量,名称dim,张量out)

2024-09-29 23:15:15 发布

您现在位置:Python中文网/ 问答频道 /正文

假设我有内存列表list_of_tensors = [tensor1, tensor2, tensor3, tensor4]。每个元素都是(1, 1, 84, 84)形的pytorch张量

我想连接张量列表,得到一个(4, 1, 84, 84)形状的张量torch.cat(TT, dim=0)可能会允许我这么做TT必须是张量的元组,因此torch.cat(*list_of_tensors, dim=0)torch.cat((*list_of_tensors), dim=0)不起作用

如何使用list_of_tensorstorch.cat(???, dim=0)创建一个新的(4, 1, 84, 84)形张量


Tags: of内存元素列表torchpytorchlistcat

热门问题