traveller59/spconv

how to align the order of indices

repoww opened this issue · 2 comments

pooling = spconv.SparseAvgPool3d(kernel_size=2, stride=2)
conv1= spconv.SparseConv3d(
        3,
        3,
        2,
        stride=2,
        padding=0,
        dilation=1,
        bias=False
    )
data = spconv.SparseConvTensor(
        features=features.cuda(),
        indices=batch_indices.cuda(),
        spatial_shape=batch_indices.max(0)[0][1:] + 1,
        batch_size=1
    )
coordinates = spconv.SparseConvTensor(
        features=raw_coordinates.cuda(),
        indices=batch_indices.cuda(),
        spatial_shape=batch_indices.max(0)[0][1:] + 1,
        batch_size=1
    )

coords = pooling(coordinates)
embeddings = conv1(data)

How can I align the indices of coords and embbeddings to be the same to use coords as input of positional encoding.
The two inputs share the same indices, with conv(stride=2) and pooling(stride=2), the output indices should be the same?

Looks like the set of the conv output and pooling output indices are the same but in different orders.

Thanks

Probably, I should do pooling of raw_coordinates based on the indice_dict from embeddings and just replace the features of embeddings