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/09/14 01:08:36 UTC

[GitHub] ChaiBapchya commented on a change in pull request #12558: [MXNET-952] added a line to check for kernel size and unittest for the same

ChaiBapchya commented on a change in pull request #12558: [MXNET-952] added a line to check for kernel size and unittest for the same
URL: https://github.com/apache/incubator-mxnet/pull/12558#discussion_r217577379
 
 

 ##########
 File path: tests/python/unittest/test_operator.py
 ##########
 @@ -6913,6 +6913,28 @@ def test_invalid_depth_dim():
     test_invalid_block_size()
     test_invalid_depth_dim()
 
+@with_seed()
+def test_correlation_kernel_size():
+    import numpy as np
+    import mxnet as mx
+
+    # Network
+    data1 = mx.symbol.Variable('data1')
+    cor = mx.sym.Correlation(data1=data1, data2=data1, kernel_size=28, stride1=1, stride2=1, pad_size=0, max_displacement=0)
+    loss = mx.sym.MakeLoss(cor, normalization='batch')
+    group = mx.symbol.Group([mx.sym.BlockGrad(cor), loss])
+
+    # Data
+    datashape = (1, 1, 28, 28)  # like mnist
+    data = np.random.rand(1, 1, 28, 28)
+
+    #Bind, execute, get computed correlation
+    executor = group.simple_bind(ctx=mx.cpu(), data1=datashape)
+    outs = executor.forward(is_train=True, data1=data)
+    cor = executor.outputs[0]
+    grad1 = executor.outputs[1]
+    print(cor)
 
 Review comment:
   Cool incorporating that

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