Skip bad frames with LSTM

Hi everyone,

I’m not sure whether there is a way to implement an LSTM that allows skipping some corrupted frame in both training and testing.

For example, I have some training data in batch mode. Each batch contains 2 videos. Each video contains 10 frames, there is a random frame among the 10 frames that is corrupted, I have a method that is able to detect which frame is corrupted. The goal is training an LSTM that can skip the corrupted video without updating its inner weights and the output of hidden states.

Best regards,
Yuhang

How about something like…

def forward(input, hidden):
    if not corrupted(input):
        output_and_hidden = self.lstm(input)
    else:
        output_and_hidden = hidden # passthrough previous output