int forward_time_input(const int & live, const int & values, const int & shape, const Edge & edge, int op_name, int input_idx)The tensor a node was handed at forward time, rebuilt — or nullptr when live still is that tensor.
live stopped being it when an in-place op that records a graph wrote
into it: the op gives it a grad_fn of its own. The write moves its
version too, so this is reached past check_version_match only
when that check is waived (is_mutation_on_saved_allowed), or when
something gave live a grad_fn without writing into it — a custom
Function that returns its input (see
Node::restore_saved_for_graph). The rebuilt tensor
holds the values the node saved by value and sits where live sat when
the node was recorded — on edge, the edge the node recorded for it —
so graph-mode backward computes what eager backward computes, and its own
derivative flows to what produced those values rather than to the write.
Parameters
liveconst std::shared_ptr<TensorImpl>&valuesconst Storage&shapeconst Shape&edgeconst Edge&op_ namestd::string_viewinput_ idxstd::size_top_name.Returns
std::shared_ptr<TensorImpl>The rebuilt tensor; nullptr when live is still the tensor the node was handed, or when the node saved no values — its formula then reads live for its shape alone.
Raises
LucidErrorvalues is not the whole input in one dtype, so there is nothing to rebuild it from.