zhreshold commented on a change in pull request #13930: Add batchify 
transformer to help end to end models
URL: https://github.com/apache/incubator-mxnet/pull/13930#discussion_r249898878
 
 

 ##########
 File path: python/mxnet/gluon/data/vision/transforms.py
 ##########
 @@ -485,3 +485,52 @@ def __init__(self, alpha):
 
     def hybrid_forward(self, F, x):
         return F.image.random_lighting(x, self._alpha)
+
+
+class Batchify(HybridBlock):
+    """Joins a list of tensors of shape (C x H x W) into a single
+    tensor of shape (N x C x H x W) where N is the number of input
+    tensors.
+
+    If the input is a single tensor of shape (C x H x W) it is bathchified
+    to a tensor of shape (1 x C x H x W).
+
+    This transformer is useful when transformation pipeline is fused into
+    neural network graph resulting in single model/graph. When running
+    mini batch inference on such graph, raw input tensors, before 
transformations,
+    can be of different shapes, hence, cannot be batched into single tensor. 
Hence,
+    input to the graph will be list of Tensors that can be batched after Resize
+    transformation.
+
+    For example, a typical graph can look like below:
+
+    Imdecode -> Resize -> Batchify -> ToTensor -> Normalize -> Network
 
 Review comment:
   This argument does not sound right, images after resize has layout HWC, 
which violate the input expectation of CHW with this Batchify block

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to