tqchen commented on a change in pull request #5913:
URL: https://github.com/apache/incubator-tvm/pull/5913#discussion_r444975331
##########
File path: python/tvm/runtime/ndarray.py
##########
@@ -278,6 +278,38 @@ def empty(shape, dtype="float32", ctx=context(1, 0)):
ctypes.byref(handle)))
return _make_array(handle, False, False)
+def non_empty(shape, dtype="float32", ctx=context(1, 0)):
Review comment:
There is no need to expose the function to here, given it is used
internally, we can simply add it to measure methods by
```
def gen_random_array():
remote.get_function("random.random_fill")
nd = nd.empty(shape, dtype, ctx)
random_fill(nd)
```
##########
File path: golang/Makefile
##########
@@ -24,7 +24,7 @@ NATIVE_SRC = tvm_runtime_pack.cc
GOPATH=$(CURDIR)/gopath
GOPATHDIR=${GOPATH}/src/${TARGET}/
-CGO_CPPFLAGS="-I. -I${TVM_BASE}/ -I${TVM_BASE}/3rdparty/dmlc-core/include
-I${TVM_BASE}/include -I${TVM_BASE}/3rdparty/dlpack/include/"
+CGO_CPPFLAGS="-I. -I${TVM_BASE}/ -I${TVM_BASE}/3rdparty/compiler-rt/
-I${TVM_BASE}/3rdparty/dmlc-core/include -I${TVM_BASE}/include
-I${TVM_BASE}/3rdparty/dlpack/include/"
Review comment:
Do not include the compiler RT part given that we can directly use
relative include in the src and compiler rt is not necessary as part of the
header file
##########
File path: src/runtime/ndarray.cc
##########
@@ -190,6 +193,49 @@ NDArray NDArray::Empty(std::vector<int64_t> shape,
DLDataType dtype, DLContext c
return ret;
}
+NDArray NDArray::NonEmpty(std::vector<int64_t> shape, DLDataType dtype,
DLContext ctx) {
Review comment:
NonEmpty is not a good name, given that what we are really doing is just
randomly fill in ndarray, we can instead call it (use a runtime PackedFunc)
`.random_fill(arr)`, consider make it part of src/runtime/rpc because it is
mainly used in rpc server.
##########
File path: src/runtime/ndarray.cc
##########
@@ -190,6 +193,49 @@ NDArray NDArray::Empty(std::vector<int64_t> shape,
DLDataType dtype, DLContext c
return ret;
}
+NDArray NDArray::NonEmpty(std::vector<int64_t> shape, DLDataType dtype,
DLContext ctx) {
Review comment:
consider put it under
https://github.com/apache/incubator-tvm/blob/master/src/runtime/contrib/random/random.cc
and always switch on random if RPC is enabled
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]