Can a DiffererntialbleViewMeta be marked as `is_view_=True` while still returning False for `has_bw_view()`?

HAOCHENYE: <p>In this function</p>
<aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L302">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L302" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L302" target="_blank" rel="noopener nofollow ugc">pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L302</a></h4>



    <pre class="onebox"><code class="lang-cpp">
      <ol class="start lines" start="292" style="counter-reset: li-counter 291 ;">
          <li>  // nodes get suppressed in some situations, see "suppress gradient</li>
          <li>  // accumulation" below. Note that only variables which have `requires_grad =</li>
          <li>  // True` can have gradient accumulators.</li>
          <li>  if (const auto&amp; gradient = self.grad_fn()) {</li>
          <li>    return Edge(gradient, self.output_nr());</li>
          <li>  } else {</li>
          <li>    return Edge(grad_accumulator(self), 0);</li>
          <li>  }</li>
          <li>}</li>
          <li></li>
          <li class="selected">void set_gradient_edge(const Variable&amp; self, Edge edge) {</li>
          <li>  auto* meta = materialize_autograd_meta(self);</li>
          <li>  meta-&gt;grad_fn_ = std::move(edge.function);</li>
          <li>  meta-&gt;output_nr_ = edge.input_nr;</li>
          <li>  // For views, make sure this new grad_fn_ is not overwritten unless it is</li>
          <li>  // necessary in the VariableHooks::grad_fn below. This logic is only relevant</li>
          <li>  // for custom autograd Functions for which multiple operations can happen on a</li>
          <li>  // given Tensor before its gradient edge is set when exiting the custom</li>
          <li>  // Function.</li>
          <li>  auto diff_view_meta = get_view_autograd_meta(self);</li>
          <li>  if (diff_view_meta &amp;&amp; diff_view_meta-&gt;has_bw_view()) {</li>
      </ol>
    </code></pre>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>I’ve observed that the <code>is_view_</code> attribute is being verified in this section of the code:</p>
<aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L386">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L386" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L386" target="_blank" rel="noopener nofollow ugc">pytorch/pytorch/blob/69aa6b4bb92b54cf24568236d35009a476ee906f/torch/csrc/autograd/variable.cpp#L386</a></h4>



    <pre class="onebox"><code class="lang-cpp">
      <ol class="start lines" start="376" style="counter-reset: li-counter 375 ;">
          <li>  // NB: could return nullptr</li>
          <li>  TORCH_CHECK(</li>
          <li>      self.defined(), "cannot call get_autograd_meta() on undefined tensor");</li>
          <li>  return static_cast&lt;AutogradMeta*&gt;(</li>
          <li>      self.unsafeGetTensorImpl()-&gt;autograd_meta());</li>
          <li>}</li>
          <li></li>
          <li>DifferentiableViewMeta* get_view_autograd_meta(const at::TensorBase&amp; self) {</li>
          <li>  // NB: return nullptr if self is not a view</li>
          <li>  AutogradMeta* meta = get_autograd_meta(self);</li>
          <li class="selected">  if (meta &amp;&amp; meta-&gt;is_view_) {</li>
          <li>    return static_cast&lt;DifferentiableViewMeta*&gt;(meta);</li>
          <li>  } else {</li>
          <li>    return nullptr;</li>
          <li>  }</li>
          <li>}</li>
          <li></li>
          <li>} // namespace impl</li>
          <li></li>
          <li>using at::Tensor;</li>
          <li></li>
      </ol>
    </code></pre>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Furthermore, the <code>diff_view_meta-&gt;has_bw_view()</code> function is being checked in the subsequent code. My understanding is that both <code>is_view_</code> and <code>backward_info_</code> are initialized when the <code>view</code> series of functions is invoked. I’m curious about the circumstances under which <code>is_view_</code> might be <code>True</code>, while <code>backward_info_</code> remains uninitialized, and yet <code>has_bw_view()</code> returns <code>False</code>.</p>