pytorch / tensordict

TensorDict is a pytorch dedicated tensor container.
MIT License
803 stars 65 forks source link

[BugFix] Fix `pad_sequence` behavior for non-tensor attributes of tensorclass #884

Closed kurtamohler closed 1 month ago

kurtamohler commented 1 month ago

Description

Fix the way pad_sequence checks for non-tensor attributes of tensorclasses. Also raise an error if pad_sequence is given tensorclasses with return_mask=True, since we cannot add the "masks" attribute with <tensorclass>.set().

Motivation and Context

close #783

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

Checklist

Go over all the following points, and put an x in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!