Add a note about THNN height/width/etc argument reordering. (#15819)
authorEdward Yang <ezyang@fb.com>
Tue, 15 Jan 2019 18:19:22 +0000 (10:19 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 15 Jan 2019 18:52:39 +0000 (10:52 -0800)
Summary:
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15819

Differential Revision: D13665297

Pulled By: ezyang

fbshipit-source-id: 4570275bc9e65269788f836f2447d09474cefeff

aten/src/ATen/nn_parse.py

index d42a439..06cdec8 100644 (file)
@@ -152,6 +152,13 @@ def get_thnn_args(thnn_function, params, inplace):
         param = params_by_name[name]
         if param['type'] == 'IntList' and 'size' in param:
             name = name + '_'
+        # NB: We calculate the dimension based on the name of
+        # the argument, not its positional order.  This means
+        # that we may reorder arguments to get them in
+        # the right place; e.g., if a THNN implementation
+        # has arguments in the order kernelW, kernelH, we
+        # will generate a caller that is kernel[1], kernel[0]
+        # to order them in the correct way.
         index = DIMENSION_OFFSET[suffix]
         if index < 0:
             index += param['size']