piiswrong commented on a change in pull request #8972: Profiling enhancements,
python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r155400761
##########
File path: src/ndarray/ndarray_function.cc
##########
@@ -26,24 +26,35 @@
#include "./ndarray_function.h"
#include "./ndarray_function-inl.h"
#include "../common/utils.h"
+#include "../operator/mxnet_op.h"
namespace mxnet {
namespace ndarray {
template<>
void Copy<cpu, cpu>(const TBlob &from, TBlob *to,
Context from_ctx, Context to_ctx,
RunContext ctx) {
+ using namespace mxnet::op;
MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
if (to->type_flag_ == from.type_flag_) {
- mshadow::Copy(to->FlatTo1D<cpu, DType>(),
- from.FlatTo1D<cpu, DType>());
+ TBlob dest = to->FlatTo1D<cpu, DType>();
+ TBlob src = from.FlatTo1D<cpu, DType>();
+ const size_t size = src.Size();
+ if (dest.CheckContiguous() && src.CheckContiguous() && size >= 20000 /*
non-trivial size */) {
Review comment:
Do this inside mxnet_op::Kernel<mxnet_op::op_with_req<mshadow_op::identity,
kWriteTo>, cpu>?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services