Correct return for undefined gradients?

I am writing custom C++ autograd functions, and found several different declarations for undefined gradients in torch::autograd::variable_list in the pytorch source code. (I.e. for non-differentiable inputs)

  1. torch::Tensor() in custom_operator/op.cpp
  2. undef, defined as Tensor undef;, in sparse_ops_gpu.cpp
  3. torch::autograd::Variable() in empedding_backward_dense_host.cpp

My questions:

  1. What is the difference between ① and ②? Does ② skip initialization of the tensor
  2. Which of ①-③ is preferable?
  3. Would it make sense to do static const Tensor undef; instead of just Tensor undef; in ②? (I am new to C++)