ATen
ATen copied to clipboard
Consider adding a nontrivial TensorRef type
Semantics are similar to const TensorImpl&
.
Motivation:
- It avoids passing
const Tensor&
which is technically a pointer to a pointer to the actual tensor - You can do const-correctness correctly on it (#27), because TensorRef would NOT support copy construction
- It solves the problem mentioned in https://github.com/zdevito/ATen/pull/112/commits/9c05ed3b6c8096a9430cb2a4a09cfb144d4a5bf8
I've considered this but until we see perf problems based on the current approach I don't want to do it. It adds complexity to the public API -- people need to understand more ATen concepts. API complexity is something that I strongly want to avoid because I think it has been what has caused people less comfortable with C++ to avoid using libraries like Eigen.