title: C++ call and definition mismatch
body: <p>I am looking at this code block at 
  <a href="https://github.com/pytorch/pytorch/blob/master/torch/csrc/autograd/profiler.cpp#L141" rel="nofollow noreferrer">https://github.com/pytorch/pytorch/blob/master/torch/csrc/autograd/profiler.cpp#L141</a></p>
  
  <pre><code>pushCallback(
        [config](const RecordFunction&amp; fn) {
          auto* msg = (fn.seqNr() &gt;= 0) ? ", seq = " : "";
          if (config.report_input_shapes) {
            std::vector&lt;std::vector&lt;int64_t&gt;&gt; inputSizes;
            inputSizes.reserve(fn.inputs().size());
            for (const c10::IValue&amp; input : fn.inputs()) {
              if (!input.isTensor()) {
                inputSizes.emplace_back();
                continue;
              }
              const at::Tensor&amp; tensor = input.toTensor();
              if (tensor.defined()) {
                inputSizes.push_back(input.toTensor().sizes().vec());
              } else {
                inputSizes.emplace_back();
              }
            }
            pushRangeImpl(fn.name(), msg, fn.seqNr(), std::move(inputSizes));
          } else {
            pushRangeImpl(fn.name(), msg, fn.seqNr(), {});
          }
        },
        [](const RecordFunction&amp; fn) {
          if (fn.getThreadId() != 0) {
            // If we've overridden the thread_id on the RecordFunction, then find
            //  the eventList that was created for the original thread_id. Then,
            // record the end event on this list so that the block is added to
            // the correct list, instead of to a new list. This should only run
            // when calling RecordFunction::end() in a different thread.
            if (state == ProfilerState::Disabled) {
              return;
            } else {
              std::lock_guard&lt;std::mutex&gt; guard(all_event_lists_map_mutex);
              const auto&amp; eventListIter =
                  all_event_lists_map.find(fn.getThreadId());
              TORCH_INTERNAL_ASSERT(
                  eventListIter != all_event_lists_map.end(),
                  "Did not find thread_id matching ",
                  fn.getThreadId());
  
              auto&amp; eventList = eventListIter-&gt;second;
              eventList-&gt;record(
                        EventKind::PopRange,
                        StringView(""),
                        fn.getThreadId(),
                        state == ProfilerState::CUDA);
            }
          } else {
            popRange();
          }
        },
        config.report_input_shapes);
  </code></pre>
  
  <p>This only has three arguments. But the definition of pushCallback seems to be at this location 
  <a href="https://github.com/pytorch/pytorch/blob/master/torch/csrc/autograd/record_function.cpp#L35" rel="nofollow noreferrer">https://github.com/pytorch/pytorch/blob/master/torch/csrc/autograd/record_function.cpp#L35</a> and takes four parameters.</p>
  
  <pre><code>void pushCallback(
        RecordFunctionCallback start,
        RecordFunctionCallback end,
        bool needs_inputs,
        bool sampled) {
      start_callbacks.push_back(std::move(start));
      end_callbacks.push_back(std::move(end));
      if (callback_needs_inputs &gt; 0 || needs_inputs) {
        ++callback_needs_inputs;
      }
      is_callback_sampled.push_back(sampled);
      if (sampled) {
        ++num_sampled_callbacks;
      }
    }
  </code></pre>
  
  <p>I don't know why that function call could work in that way. </p>