From 18b8572505708ef804cc58505a117c7c0ddc833d Mon Sep 17 00:00:00 2001 From: Gregory Chanan Date: Wed, 13 Feb 2019 10:27:23 -0800 Subject: [PATCH] Turn off the ability for Declarations.cwrap entries to be methods. Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17053 Differential Revision: D14065887 Pulled By: gchanan fbshipit-source-id: 5d06ac66d27d28d48c2aff2b0d911f34ea0cd6fd --- aten/src/ATen/function_wrapper.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/aten/src/ATen/function_wrapper.py b/aten/src/ATen/function_wrapper.py index 960bf82..737bf8a 100644 --- a/aten/src/ATen/function_wrapper.py +++ b/aten/src/ATen/function_wrapper.py @@ -834,13 +834,11 @@ def create_generic(top_env, declarations): option['const_mark'] = '' if option['inplace'] else ' const' - is_method = 'method' in option['variants'] + assert 'method' not in option['variants'], 'TH functions cannot be methods' is_function = 'function' in option['variants'] dispatch_tensor = find_dispatch_tensor(formals) is_namespace_function = is_function and dispatch_tensor is not None - check_methods_do_not_start_with_underscore(option['name'], is_method) - broadcast_arg = get_broadcast_argument(option) # "s_" for "same size". option['method_prefix_derived'] = '' if broadcast_arg is None else 's_' @@ -902,13 +900,6 @@ def create_generic(top_env, declarations): TYPE_METHOD_DEFINITION_BROADCAST.substitute(env)) method_of = ['Type'] - if is_method: - top_env['tensor_method_declarations'].append( - TENSOR_METHOD_DECLARATION.substitute(env)) - top_env['tensor_method_definitions'].append( - TENSOR_METHOD_DEFINITION.substitute(env)) - method_of.append('Tensor') - if is_namespace_function: option['inferred_type'] = 'detail::infer_type({})'.format(dispatch_tensor) top_env['function_declarations'].append( -- 2.7.4