From dcbc5dd60b288244b4ffb905a9f5959eb644f378 Mon Sep 17 00:00:00 2001 From: reminisce Date: Tue, 11 Jul 2017 16:18:53 -0700 Subject: [PATCH] Reformat --- src/ndarray/ndarray.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ndarray/ndarray.cc b/src/ndarray/ndarray.cc index 1ff6cf9fc410..80c1689dfba1 100644 --- a/src/ndarray/ndarray.cc +++ b/src/ndarray/ndarray.cc @@ -398,11 +398,14 @@ void CopyFromToImpl(const NDArray from, NDArray *to, RunContext ctx) { // if storage type doesn't match, cast the storage first auto from_stype = from.storage_type(); auto to_stype = to->storage_type(); - CHECK(from_stype == kDefaultStorage || to_stype == kDefaultStorage) + CHECK(from_stype == kDefaultStorage + || to_stype == kDefaultStorage + || from_stype == to_stype) << "Copying ndarray of stype = " << from_stype << " to stype = " << to_stype << " is not supported"; const auto from_ctx = from.ctx(); const auto to_ctx = to->ctx(); + auto s = ctx.get_stream(); if (from_ctx == to_ctx && from_stype != to_stype) { // same ctx, different stypes, use cast op directly without copying common::CastStorageDispatch(s, from, *to); @@ -412,7 +415,6 @@ void CopyFromToImpl(const NDArray from, NDArray *to, RunContext ctx) { casted_nd = from; // same stype, no need to cast from } else { // different stypes on different ctx needs an temporary casted_nd TShape shape = from.shape(); - auto s = ctx.get_stream(); if (to_stype == kDefaultStorage) { casted_nd = NDArray(shape, from_ctx); } else {