Skip to content
fn

refuse_phantom_outside_mode

void refuse_phantom_outside_mode(const int & s, int what)

The contract for a phantom outside phantom mode: it is inert. Its shape, dtype, device and autograd flags read as any tensor's, and a write into it is absorbed (absorbs_phantom_write), but an op that would read its values or make a new phantom of it — every op does one or the other — refuses here. A phantom is made only under the mode, so a block's result can never reach real code dressed as a real tensor. Called where those two things happen, TensorImpl::storage() and TensorImpl::make_view.