How to slice a different ndarray from a large ndarray


#1

I am trying to optimzie the memory plan for concat/split/slice op. For example, with apropriate memory plan, inputs of ConcatOp can write to their outputs corresponding to the slice of the ConcatOp output, so the concat op can be totally optimized out.
So in the InitDataEntryMemory, I make the input share the slice of the ConcatOp output NDArray,
The following code is ok in v0.12, but in latest v1.2, NDArray::AsArray will fail for CHECK(!IsView()), so how can i slice the sub array for one large NDArray?

          auto entry_bytes = vshape[i].Size() * mshadow::mshadow_sizeof(vdtype[i]);
          NDArray src_1d = src.AsArray(nnvm::TShape({static_cast<nnvm::dim_t>(sid_bytes), 1 }), mshadow::kInt8);
          NDArray dst_1d = src_1d.Slice(ventry_offset[i], entry_bytes + ventry_offset[i]);
          data_entry_[i] = dst_1d.AsArray(vshape[i], vdtype[i]);