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_'
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(