I’m looking for a way to ignore certain steps of a time series based on a boolean vector. In Keras something like this can be achieved using the mask parameter but I could not figure out how to do this in pytorch:

tensorflow keras example:

```
from keras.layers import Input, LSTM, Reshape
from keras.models import Model
import numpy as np
import tensorflow as tf
words = Input(shape=(30, 256), dtype='float32', name='words')
# Create a dummy mask selecting every second step of the time series
np_mask = np.array([x % 2 == 0 for x in range(0,5*30)])
tf_mask = tf.reshape(tf.constant(np_mask), (5, 30))
lstm1 = LSTM(5)(words, mask=tf_mask)
model = Model(inputs=[words], outputs=lstm1)
```

I’ve found several posts about using PackedSequence for right-padded series, but I couldn’t find anything for skipping steps somewhere in the middle.