title: Pytorch: Devolving into nan Batch losses/Log probs
body: <p>I'm using pytorch as the basis for some machine translation tasks I want to do.
  When instantiating my dataset, I have as each torchtext.data.Example a [list(untokenized_string_sentence), untokenized_string_sentence, untokenized_string_sentence]
  where untokenized_string_sentence is a just a raw example sentence. I've made sure to be careful about handling the first input as a list in some custom <code>forward</code> functions. However, I don't know if the batch loss computation is treating it accordingly, or if I need to be careful about this. I'm simply calling <code>nn.CrossEntropyLoss()</code> with label smoothing and padding. The result after a couple of batches is a completely <code>NaN</code> forward pass (and subsequently, NaN softmax values and loss).</p>
  
  <p>Does anyone know if there is issue in differing types of inputs using PyTorch? </p>
  
  <p>Here are how my types are defined:</p>
  
  <pre><code>    src_field = data.Field(init_token=None, eos_token=EOS_TOKEN,
                             pad_token=PAD_TOKEN, tokenize=tok_fun,
                             batch_first=True, lower=lowercase,
                             unk_token=UNK_TOKEN,
                             include_lengths=True)
  
      trg_field = data.Field(init_token=BOS_TOKEN, eos_token=EOS_TOKEN,
                             pad_token=PAD_TOKEN, tokenize=tok_fun,
                             unk_token=UNK_TOKEN,
                             batch_first=True, lower=lowercase,
                             include_lengths=True)
      prev_inputs_field = data.NestedField(data.Field(init_token=CONTEXT_TOKEN, eos_token=CONTEXT_EOS_TOKEN,
                             pad_token=PAD_TOKEN, tokenize=tok_fun,
                             batch_first=True, lower=lowercase,
                             unk_token=UNK_TOKEN,
                             include_lengths=False), tokenize=sent_fun)
  </code></pre>