1# shape: torch.Size([]) 2# nnz: 2 3# sparse_dim: 0 4# indices shape: torch.Size([0, 2]) 5# values shape: torch.Size([2]) 6########## torch.int32 ########## 7# sparse tensor 8tensor(indices=tensor([], size=(0, 2)), 9 values=tensor([0, 1]), 10 device='cuda:0', size=(), nnz=2, dtype=torch.int32, 11 layout=torch.sparse_coo) 12# _indices 13tensor([], device='cuda:0', size=(0, 2), dtype=torch.int64) 14# _values 15tensor([0, 1], device='cuda:0', dtype=torch.int32) 16########## torch.float32 ########## 17# sparse tensor 18tensor(indices=tensor([], size=(0, 2)), 19 values=tensor([0., 1.]), 20 device='cuda:0', size=(), nnz=2, layout=torch.sparse_coo) 21# after requires_grad_ 22tensor(indices=tensor([], size=(0, 2)), 23 values=tensor([0., 1.]), 24 device='cuda:0', size=(), nnz=2, layout=torch.sparse_coo, 25 requires_grad=True) 26# after addition 27tensor(indices=tensor([], size=(0, 1)), 28 values=tensor([2.]), 29 device='cuda:0', size=(), nnz=1, layout=torch.sparse_coo, 30 grad_fn=<AddBackward0>) 31# _indices 32tensor([], device='cuda:0', size=(0, 2), dtype=torch.int64) 33# _values 34tensor([0., 1.], device='cuda:0') 35 36# shape: torch.Size([0]) 37# nnz: 10 38# sparse_dim: 0 39# indices shape: torch.Size([0, 10]) 40# values shape: torch.Size([10, 0]) 41########## torch.int32 ########## 42# sparse tensor 43tensor(indices=tensor([], size=(0, 10)), 44 values=tensor([], size=(10, 0)), 45 device='cuda:0', size=(0,), nnz=10, dtype=torch.int32, 46 layout=torch.sparse_coo) 47# _indices 48tensor([], device='cuda:0', size=(0, 10), dtype=torch.int64) 49# _values 50tensor([], device='cuda:0', size=(10, 0), dtype=torch.int32) 51########## torch.float64 ########## 52# sparse tensor 53tensor(indices=tensor([], size=(0, 10)), 54 values=tensor([], size=(10, 0)), 55 device='cuda:0', size=(0,), nnz=10, dtype=torch.float64, 56 layout=torch.sparse_coo) 57# after requires_grad_ 58tensor(indices=tensor([], size=(0, 10)), 59 values=tensor([], size=(10, 0)), 60 device='cuda:0', size=(0,), nnz=10, dtype=torch.float64, 61 layout=torch.sparse_coo, requires_grad=True) 62# after addition 63tensor(indices=tensor([], size=(0, 1)), 64 values=tensor([], size=(1, 0)), 65 device='cuda:0', size=(0,), nnz=1, dtype=torch.float64, 66 layout=torch.sparse_coo, grad_fn=<AddBackward0>) 67# _indices 68tensor([], device='cuda:0', size=(0, 10), dtype=torch.int64) 69# _values 70tensor([], device='cuda:0', size=(10, 0), dtype=torch.float64) 71 72# shape: torch.Size([2]) 73# nnz: 3 74# sparse_dim: 0 75# indices shape: torch.Size([0, 3]) 76# values shape: torch.Size([3, 2]) 77########## torch.int32 ########## 78# sparse tensor 79tensor(indices=tensor([], size=(0, 3)), 80 values=tensor([[0, 0], 81 [0, 1], 82 [1, 1]]), 83 device='cuda:0', size=(2,), nnz=3, dtype=torch.int32, 84 layout=torch.sparse_coo) 85# _indices 86tensor([], device='cuda:0', size=(0, 3), dtype=torch.int64) 87# _values 88tensor([[0, 0], 89 [0, 1], 90 [1, 1]], device='cuda:0', dtype=torch.int32) 91########## torch.float32 ########## 92# sparse tensor 93tensor(indices=tensor([], size=(0, 3)), 94 values=tensor([[0.0000, 0.3333], 95 [0.6667, 1.0000], 96 [1.3333, 1.6667]]), 97 device='cuda:0', size=(2,), nnz=3, layout=torch.sparse_coo) 98# after requires_grad_ 99tensor(indices=tensor([], size=(0, 3)), 100 values=tensor([[0.0000, 0.3333], 101 [0.6667, 1.0000], 102 [1.3333, 1.6667]]), 103 device='cuda:0', size=(2,), nnz=3, layout=torch.sparse_coo, 104 requires_grad=True) 105# after addition 106tensor(indices=tensor([], size=(0, 1)), 107 values=tensor([[4.0000, 6.0000]]), 108 device='cuda:0', size=(2,), nnz=1, layout=torch.sparse_coo, 109 grad_fn=<AddBackward0>) 110# _indices 111tensor([], device='cuda:0', size=(0, 3), dtype=torch.int64) 112# _values 113tensor([[0.0000, 0.3333], 114 [0.6667, 1.0000], 115 [1.3333, 1.6667]], device='cuda:0') 116 117# shape: torch.Size([100, 3]) 118# nnz: 3 119# sparse_dim: 1 120# indices shape: torch.Size([1, 3]) 121# values shape: torch.Size([3, 3]) 122########## torch.int32 ########## 123# sparse tensor 124tensor(indices=tensor([[0, 1, 2]]), 125 values=tensor([[0, 0, 0], 126 [0, 0, 1], 127 [1, 1, 1]]), 128 device='cuda:0', size=(100, 3), nnz=3, dtype=torch.int32, 129 layout=torch.sparse_coo) 130# _indices 131tensor([[0, 1, 2]], device='cuda:0') 132# _values 133tensor([[0, 0, 0], 134 [0, 0, 1], 135 [1, 1, 1]], device='cuda:0', dtype=torch.int32) 136########## torch.float64 ########## 137# sparse tensor 138tensor(indices=tensor([[0, 1, 2]]), 139 values=tensor([[0.0000, 0.2222, 0.4444], 140 [0.6667, 0.8889, 1.1111], 141 [1.3333, 1.5556, 1.7778]]), 142 device='cuda:0', size=(100, 3), nnz=3, dtype=torch.float64, 143 layout=torch.sparse_coo) 144# after requires_grad_ 145tensor(indices=tensor([[0, 1, 2]]), 146 values=tensor([[0.0000, 0.2222, 0.4444], 147 [0.6667, 0.8889, 1.1111], 148 [1.3333, 1.5556, 1.7778]]), 149 device='cuda:0', size=(100, 3), nnz=3, dtype=torch.float64, 150 layout=torch.sparse_coo, requires_grad=True) 151# after addition 152tensor(indices=tensor([[0, 1, 2, 0, 1, 2]]), 153 values=tensor([[0.0000, 0.2222, 0.4444], 154 [0.6667, 0.8889, 1.1111], 155 [1.3333, 1.5556, 1.7778], 156 [0.0000, 0.2222, 0.4444], 157 [0.6667, 0.8889, 1.1111], 158 [1.3333, 1.5556, 1.7778]]), 159 device='cuda:0', size=(100, 3), nnz=6, dtype=torch.float64, 160 layout=torch.sparse_coo, grad_fn=<AddBackward0>) 161# _indices 162tensor([[0, 1, 2]], device='cuda:0') 163# _values 164tensor([[0.0000, 0.2222, 0.4444], 165 [0.6667, 0.8889, 1.1111], 166 [1.3333, 1.5556, 1.7778]], device='cuda:0', dtype=torch.float64) 167 168# shape: torch.Size([100, 20, 3]) 169# nnz: 0 170# sparse_dim: 2 171# indices shape: torch.Size([2, 0]) 172# values shape: torch.Size([0, 3]) 173########## torch.int32 ########## 174# sparse tensor 175tensor(indices=tensor([], size=(2, 0)), 176 values=tensor([], size=(0, 3)), 177 device='cuda:0', size=(100, 20, 3), nnz=0, dtype=torch.int32, 178 layout=torch.sparse_coo) 179# _indices 180tensor([], device='cuda:0', size=(2, 0), dtype=torch.int64) 181# _values 182tensor([], device='cuda:0', size=(0, 3), dtype=torch.int32) 183########## torch.float32 ########## 184# sparse tensor 185tensor(indices=tensor([], size=(2, 0)), 186 values=tensor([], size=(0, 3)), 187 device='cuda:0', size=(100, 20, 3), nnz=0, layout=torch.sparse_coo) 188# after requires_grad_ 189tensor(indices=tensor([], size=(2, 0)), 190 values=tensor([], size=(0, 3)), 191 device='cuda:0', size=(100, 20, 3), nnz=0, layout=torch.sparse_coo, 192 requires_grad=True) 193# after addition 194tensor(indices=tensor([], size=(2, 0)), 195 values=tensor([], size=(0, 3)), 196 device='cuda:0', size=(100, 20, 3), nnz=0, layout=torch.sparse_coo, 197 grad_fn=<AddBackward0>) 198# _indices 199tensor([], device='cuda:0', size=(2, 0), dtype=torch.int64) 200# _values 201tensor([], device='cuda:0', size=(0, 3)) 202 203# shape: torch.Size([10, 0, 3]) 204# nnz: 3 205# sparse_dim: 0 206# indices shape: torch.Size([0, 3]) 207# values shape: torch.Size([3, 10, 0, 3]) 208########## torch.int32 ########## 209# sparse tensor 210tensor(indices=tensor([], size=(0, 3)), 211 values=tensor([], size=(3, 10, 0, 3)), 212 device='cuda:0', size=(10, 0, 3), nnz=3, dtype=torch.int32, 213 layout=torch.sparse_coo) 214# _indices 215tensor([], device='cuda:0', size=(0, 3), dtype=torch.int64) 216# _values 217tensor([], device='cuda:0', size=(3, 10, 0, 3), dtype=torch.int32) 218########## torch.float64 ########## 219# sparse tensor 220tensor(indices=tensor([], size=(0, 3)), 221 values=tensor([], size=(3, 10, 0, 3)), 222 device='cuda:0', size=(10, 0, 3), nnz=3, dtype=torch.float64, 223 layout=torch.sparse_coo) 224# after requires_grad_ 225tensor(indices=tensor([], size=(0, 3)), 226 values=tensor([], size=(3, 10, 0, 3)), 227 device='cuda:0', size=(10, 0, 3), nnz=3, dtype=torch.float64, 228 layout=torch.sparse_coo, requires_grad=True) 229# after addition 230tensor(indices=tensor([], size=(0, 1)), 231 values=tensor([], size=(1, 10, 0, 3)), 232 device='cuda:0', size=(10, 0, 3), nnz=1, dtype=torch.float64, 233 layout=torch.sparse_coo, grad_fn=<AddBackward0>) 234# _indices 235tensor([], device='cuda:0', size=(0, 3), dtype=torch.int64) 236# _values 237tensor([], device='cuda:0', size=(3, 10, 0, 3), dtype=torch.float64) 238 239# shape: torch.Size([10, 0, 3]) 240# nnz: 0 241# sparse_dim: 0 242# indices shape: torch.Size([0, 0]) 243# values shape: torch.Size([0, 10, 0, 3]) 244########## torch.int32 ########## 245# sparse tensor 246tensor(indices=tensor([], size=(0, 0)), 247 values=tensor([], size=(0, 10, 0, 3)), 248 device='cuda:0', size=(10, 0, 3), nnz=0, dtype=torch.int32, 249 layout=torch.sparse_coo) 250# _indices 251tensor([], device='cuda:0', size=(0, 0), dtype=torch.int64) 252# _values 253tensor([], device='cuda:0', size=(0, 10, 0, 3), dtype=torch.int32) 254########## torch.float32 ########## 255# sparse tensor 256tensor(indices=tensor([], size=(0, 0)), 257 values=tensor([], size=(0, 10, 0, 3)), 258 device='cuda:0', size=(10, 0, 3), nnz=0, layout=torch.sparse_coo) 259# after requires_grad_ 260tensor(indices=tensor([], size=(0, 0)), 261 values=tensor([], size=(0, 10, 0, 3)), 262 device='cuda:0', size=(10, 0, 3), nnz=0, layout=torch.sparse_coo, 263 requires_grad=True) 264# after addition 265tensor(indices=tensor([], size=(0, 0)), 266 values=tensor([], size=(0, 10, 0, 3)), 267 device='cuda:0', size=(10, 0, 3), nnz=0, layout=torch.sparse_coo, 268 grad_fn=<AddBackward0>) 269# _indices 270tensor([], device='cuda:0', size=(0, 0), dtype=torch.int64) 271# _values 272tensor([], device='cuda:0', size=(0, 10, 0, 3)) 273