TensorComprehensions
TensorComprehensions copied to clipboard
Handle temporaries
right now, everything is either an input or output. Reason being TC does not do any allocation by itself. We should find a better way to handle this
cc Albert Cohen who is interested in this
We had discussions about this with @Yangqing, @zdevito and others that it would be easy to:
- split into
inputs, outputs, temporaries
- pass a
alloc
and afree
lambda operating on DLTensors that should a. convert back to a particularframework X
tensor type of choice form DLPack b. alloc the tmp automatically using inferred sizes, it is the responsibility offramework X
to ensure thatalloc/free
have decent perf (e.g use a view in a preallocated buffer) c. free the tmp once the call to run exits. - this will help to automatically infer the positional arguments gradInput form output and let tensors that live in tmp be just the tensors that are written to and that are not declared as output.