junrushao1994 commented on a change in pull request #13283: [MXNET-1215] Allow
dynamic shape exists in imperative mode
URL: https://github.com/apache/incubator-mxnet/pull/13283#discussion_r234889986
##########
File path: include/mxnet/ndarray.h
##########
@@ -103,7 +103,18 @@ class NDArray {
bool delay_alloc = true, int dtype = mshadow::default_type_flag,
std::vector<int> aux_types = {}, std::vector<TShape> aux_shapes = {},
TShape storage_shape = TShape(mshadow::Shape1(0)));
-
+ /*!
+ * \brief constructs a new dynamic NDArray whose shape is unknown,
+ * hence the NDArray is inherently lazily created
+ * \param ctx context of NDArray
+ * \param dtype data type of this ndarray
+ */
+ explicit NDArray(Context ctx, int dtype = mshadow::default_type_flag) {
+ ptr_ = std::make_shared<Chunk>(TShape(mshadow::Shape1(0)), ctx, true,
dtype);
Review comment:
@ZhennanQin Sorry I was too hurry. Personally, I think it is okay just to
leave it 0-d for now. In the long term, we could support 0-d tensors in a more
systematic approach.
----------------------------------------------------------------
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