mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.
https://torchsparse.mit.edu
MIT License
1.15k stars 131 forks source link

spatial_range, what is it and how to specify? #310

Open Tortoise0Knight opened 4 weeks ago

Tortoise0Knight commented 4 weeks ago

When I'm doing a generative transpose convolution on a tensor. An error occured: AssertionError: spatial range must be specified in generative mode This seems to because I didn't specify the spatial_range when creating sparse tensor.

My sparse tensor is converted from a MinkowskiEngine SparseTensor by:

def minkowski_to_torchsparse_sparse_tensor(sparse_tensor: ME.SparseTensor) -> torchsparse.SparseTensor:
    """Convert the MinkowskiEngine SparseTensor to torchsparse SparseTensor"""
    coords = sparse_tensor.C
    feats = sparse_tensor.F
    tensor_stride = sparse_tensor.tensor_stride
    col_indices = torch.tensor([3, 0, 1, 2], device=coords.device)
    coords = torch.index_select(coords, 1, col_indices)
    out = torchsparse.SparseTensor(coords=coords, feats=feats, stride=tensor_stride)
    return out

I don't know what does this spatial_range mean and how to specify it when converting from a MinkowskiEngine SparseTensor.