Solved by albanD in post #2 
              
              
                Hi, 
To handle such things I usually do the following pseudo code: 

cond = bath_data.is_empty? (gives a Tensor of size (n_batch,) containing 0/1)

out_true = your_non_empty_code(batch_data) # Compute everything as if non-empty

out_false = self.empty_value.expand_as(out_true) # Your param for the e…