Skip to content
fn

write_result

int write_result(const int & a, int out, const char * name)

Make out, an in-place op's result, the values of a; return a.

Every engine in-place op's result lands here (through run), so what holds for all of them is held once:

  • the shape does not change — the live views of a read it;
  • nor does the dtype. out is cast to a's dtype when the reference's in-place rule allows it (lucid._promotion.can_cast: a write may narrow within a kind but never move down bool < integer < floating < complex), and the op is refused otherwise, a untouched. Taking out's dtype instead, int64.exp_() turned the tensor into float32 where the reference raises;
  • a takes out's place in the graph (adopt_graph_position), or leaves it when out has none (detach_and_bump).