xref: /aosp_15_r20/external/pytorch/torchgen/api/meta.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard Workerfrom torchgen.model import NativeFunctionsGroup
2*da0073e9SAndroid Build Coastguard Worker
3*da0073e9SAndroid Build Coastguard Worker
4*da0073e9SAndroid Build Coastguard Worker# Follows dispatcher calling convention, but:
5*da0073e9SAndroid Build Coastguard Worker#   - Mutable arguments not allowed.  Meta functions are always
6*da0073e9SAndroid Build Coastguard Worker#     written in functional form.  Look at FunctionSchema.signature()
7*da0073e9SAndroid Build Coastguard Worker#   - No tensor returns; instead we return a TensorMeta describing
8*da0073e9SAndroid Build Coastguard Worker#     the tensor in question
9*da0073e9SAndroid Build Coastguard Worker
10*da0073e9SAndroid Build Coastguard Worker
11*da0073e9SAndroid Build Coastguard Workerdef name(g: NativeFunctionsGroup) -> str:
12*da0073e9SAndroid Build Coastguard Worker    # use the overload name from the functional version
13*da0073e9SAndroid Build Coastguard Worker    return str(g.functional.func.name).replace(".", "_")
14