Open nicholas-leonard opened 9 years ago
it is not clear with copyAs as to what the "As" is doing. i would not think that copyAs means resizeAs + copy.
Yeah but it is shorter than a:copyResizeAs(b)
.
We could also just modify the existing copy interface to include a [resizeAs]
flag that default to false. So then we would have a very elegant : a:copy(b, true)
.
I know its a small fix. Its just that the a:resizeAs(b):copy(b)
pattern is so common. Its also kind of counter-intuitive since most other methods a:add(b,c)
, a:cmul(b,c)
, etc. automatically resize the result tensor. Although I do understand the necessity of requiring an explicit resize before a copy.
Basically, we could substitute
a:copyAs(b)
fora:resizeAs(b):copy(b)
.