Jen*_*sun 5 python jagged-arrays ragged pytorch
Tensorflow提供参差不齐的张量(https://www.tensorflow.org/guide/ragged_tensor)。但是,PyTorch不提供这种数据结构。有没有在PyTorch中构造类似内容的解决方法?
import numpy as np
x = np.array([[0], [0, 1]])
print(x)  # [list([0]) list([0, 1])]
import tensorflow as tf
x = tf.ragged.constant([[0], [0, 1]])
print(x)  # <tf.RaggedTensor [[0], [0, 1]]>
import torch
# x = torch.Tensor([[0], [0, 1]])  # ValueError
| 归档时间: | 
 | 
| 查看次数: | 136 次 | 
| 最近记录: |