You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/03/26 16:01:38 UTC

[GitHub] ashkanaev opened a new issue #10249: Custom interpolation layer. Gluon.

ashkanaev opened a new issue #10249: Custom interpolation layer. Gluon. 
URL: https://github.com/apache/incubator-mxnet/issues/10249
 
 
   How to realize custom layer (bilinear interpolation) for gluon without input tensor shape? 
   The issue is hardlink to target size. I want to realize layer for resize arbitrary tensor with some factor. 
   I found, that SpatialTransformer is what i really need, but target size makes this code inflexible. 
   
   Could i realize custom symbol layer with symbol layer? 
   
   
   class Inter(Block):
       def __init__(self, factor, target_size, **kwargs):
           super(Inter, self).__init__(**kwargs)
   
           self._affine = mx.nd.reshape(mx.nd.array([[1. * factor, 0, 0],
                                    [0, 1. * factor, 0]]), shape=(1, 6))
   
           self.target_size = target_size
   
   
   
       def forward(self, x):
           out = mx.nd.SpatialTransformer(x,
                                      self.affine_matrix,
                                      self.target_size,
                                      'affine',
                                      'bilinear'
                                      )
   

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


With regards,
Apache Git Services