From c5b50a3440f6bf2c503a3f06e8e5b4b4f66f60ad Mon Sep 17 00:00:00 2001 From: Gregory Chanan Date: Wed, 13 Mar 2019 15:07:49 -0700 Subject: [PATCH] Remove AssertNDim, which doesn't seem to be used. 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 | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 tools/cwrap/plugins/AssertNDim.py diff --git a/tools/cwrap/plugins/AssertNDim.py b/tools/cwrap/plugins/AssertNDim.py deleted file mode 100644 index 599a067..0000000 --- a/tools/cwrap/plugins/AssertNDim.py +++ /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 -- 2.7.4