MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _convert_

Function _convert_

python/paddle/tensor/layer_function_generator.py:38–51  ·  view source on GitHub ↗

Formatting. Args: name: The name/alias This function takes in a name and converts it to a standard format of group1_group2. Where as per the regular expression, group1 can have alphabets and numbers and group2 has capital alphabets.

(name)

Source from the content-addressed store, hash-verified

36
37
38def _convert_(name):
39 """
40 Formatting.
41
42 Args:
43 name: The name/alias
44
45 This function takes in a name and converts it to a standard format of
46 group1_group2. Where as per the regular expression, group1 can have
47 alphabets and numbers and group2 has capital alphabets.
48
49 """
50 s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
51 return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
52
53
54def generate_layer_fn(op_type: str):

Callers 12

test_batch_normMethod · 0.90
test_reluMethod · 0.90
test_conv2dMethod · 0.90
test_sigmoidMethod · 0.90
test_softmaxMethod · 0.90
test_single_lowercaseMethod · 0.90
test_mixed_caseMethod · 0.90
test_geluMethod · 0.90
infer_and_check_dtypeFunction · 0.70
funcFunction · 0.70

Calls 1

lowerMethod · 0.80

Tested by 10

test_batch_normMethod · 0.72
test_reluMethod · 0.72
test_conv2dMethod · 0.72
test_sigmoidMethod · 0.72
test_softmaxMethod · 0.72
test_single_lowercaseMethod · 0.72
test_mixed_caseMethod · 0.72
test_geluMethod · 0.72