andrewfayres commented on a change in pull request #12848: Fix Batch input
issue with Scala Benchmark
URL: https://github.com/apache/incubator-mxnet/pull/12848#discussion_r226140733
##########
File path:
scala-package/infer/src/main/scala/org/apache/mxnet/infer/ImageClassifier.scala
##########
@@ -182,7 +180,7 @@ object ImageClassifier {
resizedImage.flush()
// creating NDArray according to the input shape
- val pixelsArray = NDArray.array(result, shape = inputImageShape)
+ val pixelsArray = NDArray.array(result, shape = new Shape(1 +:
inputImageShape.toVector))
Review comment:
This seems odd. Everywhere that I see this method called they are doing
shape.drop(1) then here you're add back in the first dim.
I get that this is being done because the first dim in the original shape is
the batch size and here it's essentially replacing that with batchSize =1. The
thing that I don't like is the method is now assuming the dimensions required
by the caller. In other words, this is moving from being a general
implementation for transforming a buffered image into an ndarray of pixel
values to being tightly coupled to the calling method's implementation.
----------------------------------------------------------------
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