title: Torch JIT Trace = TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect
body: <p>I am following this tutorial: <a href="https://huggingface.co/transformers/torchscript.html" rel="noreferrer">https://huggingface.co/transformers/torchscript.html</a>
  to create a trace of my custom BERT model, however when running the exact same <code>dummy_input</code> I receive an error:</p>
  <pre><code>TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. 
  We cant record the data flow of Python values, so this value will be treated as a constant in the future. 
  </code></pre>
  <p>Having loaded in my model and tokenizer, the code to create the trace is the following:</p>
  <pre><code>text = &quot;[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]&quot;
  tokenized_text = tokenizer.tokenize(text)
  
  # Masking one of the input tokens
  masked_index = 8
  tokenized_text[masked_index] = '[MASK]'
  indexed_tokens = tokenizer.convert_tokens_to_ids(tokenized_text)
  segments_ids = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
  
  tokens_tensor = torch.tensor([indexed_tokens])
  segments_tensors = torch.tensor([segments_ids])
  dummy_input = [tokens_tensor, segments_tensors]
  
  traced_model = torch.jit.trace(model, dummy_input)
  </code></pre>
  <p>The <code>dummy_input</code> is a list of tensors so I'm not sure where the <code>Boolean</code> type is coming into play here. Does anyone understand why this error is occurring and whether the Boolean conversion is happening?</p>
  <p>Many Thanks</p>