Deephome opened a new issue #13572: How to use 
ndarray.contrib.DeformableConvolution ?
URL: https://github.com/apache/incubator-mxnet/issues/13572
 
 
   I define a module performing deformable convolution as follows, but I do not 
know how to save the parameters (self.weight, self.bias) of this module using 
"net.save_parameters()" ...
   
   class DeformConv2D(nn.Block):
        def 
__init__(self,in_channel,num_filter,kernel=(5,5),pad=(2,2),stride=(1,1)):
                super(DeformConv2D, self).__init__()
                self.in_channel = in_channel
                self.num_filter = num_filter
                self.kernel = kernel
                self.pad = pad
                self.stride = stride
                self.weight = 
nd.normal(loc=0.,scale=1.,shape=(num_filter,in_channel,kernel[0],kernel[1]),ctx=gpu())
                self.bias = nd.zeros((num_filter,),ctx=gpu())
   
                self.weight.attach_grad()
                self.bias.attach_grad()
   
        def forward(self, inputs, offset):
                if self.weight.context != inputs.context:
                        self.weight = self.weight.copyto(inputs.context)
                        self.bias  = self.bias.copyto(inputs.context)
   
                outputs = ndarray.contrib.DeformableConvolution(data=inputs, 
offset=offset,weight=self.weight,bias=self.bias, kernel=self.kernel, 
num_filter=self.num_filter,pad=self.pad,no_bias=self.no_bias)
   
                return outputs

----------------------------------------------------------------
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

Reply via email to