Support broadcasting in copy

a.copy_(b) will now broadcast b to the shape of a. Note that this means
that copies between tensors of the same number of elements but
incompatible shapes are not allowed. For example, the following will
throw an exception:

  Tensor a = type.rand({4, 43);
  Tensor e = type.rand({3, 4});
  a.copy_(e)
6 files changed