nestedtensor icon indicating copy to clipboard operation
nestedtensor copied to clipboard

to_tensor_mask() API should allow empty tensors

Open izdeby opened this issue 5 years ago • 0 comments

As of right now, we are not supporting empty tensors in nested tensor when calling to_tensor_mask() method.

Example case:

        nt1 = nt.nested_tensor([
            nt.nested_tensor([
                nt.nested_tensor([
                    torch.tensor([], dtype=torch.float)
                ]),
                nt.nested_tensor([
                    torch.tensor([1], dtype=torch.float),
                    torch.tensor([1], dtype=torch.float)
                ]),
                nt.nested_tensor([
                    torch.tensor([2, 3], dtype=torch.float)
                ]),
            ])
        ])

It's unclear what the result should look like for this nested tensors.

Possible solutions to this problem is to introduce nested_size flag for nested_tensor_from_tensor_mask() method but we need more info to come up with the best solution.

izdeby avatar Feb 19 '20 21:02 izdeby