Remove AssertNDim, which doesn't seem to be used.
authorGregory Chanan <gchanan@fb.com>
Wed, 13 Mar 2019 22:07:49 +0000 (15:07 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 13 Mar 2019 22:10:55 +0000 (15:10 -0700)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17978

Reviewed By: colesbury

Differential Revision: D14438845

Pulled By: gchanan

fbshipit-source-id: 106650c37fb1885201eaef27cb6d86b49ef27976

tools/cwrap/plugins/AssertNDim.py [deleted file]

diff --git a/tools/cwrap/plugins/AssertNDim.py b/tools/cwrap/plugins/AssertNDim.py
deleted file mode 100644 (file)
index 599a067..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-from . import CWrapPlugin
-from string import Template
-
-
-class AssertNDim(CWrapPlugin):
-
-    PRE_CODE_TEMPLATE = Template(
-        """if(THTensor_(nDimensionLegacyNoScalars)(LIBRARY_STATE ${arg_op}) != ${dim_value}) {
-             THError("Expected argument %s to have %d dimension(s), but has %d",
-                     "${op}", ${dim_value}, THTensor_(nDimensionLegacyNoScalars)(LIBRARY_STATE ${arg_op}));
-           }
-        """)
-
-    def process_option_code_template(self, template, option):
-        new_code_pre = []
-
-        for _, arg in enumerate(option['arguments']):
-            if 'assert_ndim' not in arg:
-                continue
-
-            dim_value = arg.get('assert_ndim')
-            op = arg.get('assign_name', arg['name'])
-            arg_op = "arg_" + op
-            new_code_pre.append(self.PRE_CODE_TEMPLATE.substitute(op=op,
-                                                                  arg_op=arg_op,
-                                                                  dim_value=dim_value))
-            template = new_code_pre + template
-
-        return template