def parse_call_function_target(target: _Any) -> str:
    """
    Parses the call function target for the function-name and returns it.
    Initially, will try to lookup the function inside a dictionary that maps
    known functions to function-names. If the function is not found in the dictionary,
    then will use custom parsing code to get the function-name.
    """

    if not _HAS_TORCH_VISION:
        raise ImportError(MSG_TORCH_VISION_NOT_FOUND)

    func_map = {
        _torch.nn.functional.conv1d: "conv1d",
        _torch.nn.functional.conv2d: "conv2d",
        _torch.nn.functional.conv3d: "conv3d",
        _torch.nn.functional.conv_transpose1d: "conv_transpose1d",
        _torch.nn.functional.conv_transpose2d: "conv_transpose2d",
        _torch.nn.functional.conv_transpose3d: "conv_transpose3d",
        _torch.nn.functional.unfold: "unfold",
        _torch.nn.functional.fold: "fold",
        _torch.nn.functional.avg_pool1d: "avg_pool1d",
        _torch.nn.functional.avg_pool2d: "avg_pool2d",
        _torch.nn.functional.avg_pool3d: "avg_pool3d",
        _torch.nn.functional.max_pool1d: "max_pool1d",
        _torch.nn.functional.max_pool2d: "max_pool2d",
        _torch.nn.functional.max_pool3d: "max_pool3d",
        _torch.nn.functional.max_unpool1d: "max_unpool1d",
        _torch.nn.functional.max_unpool2d: "max_unpool2d",
        _torch.nn.functional.max_unpool3d: "max_unpool3d",
        _torch.nn.functional.lp_pool1d: "lp_pool1d",
        _torch.nn.functional.lp_pool2d: "lp_pool2d",
        _torch.nn.functional.adaptive_max_pool1d: "adaptive_max_pool1d",
        _torch.nn.functional.adaptive_max_pool2d: "adaptive_max_pool2d",
        _torch.nn.functional.adaptive_max_pool3d: "adaptive_max_pool3d",
        _torch.nn.functional.adaptive_avg_pool1d: "adaptive_avg_pool1d",
        _torch.nn.functional.adaptive_avg_pool2d: "adaptive_avg_pool2d",
        _torch.nn.functional.adaptive_avg_pool3d: "adaptive_avg_pool3d",
        _torch.nn.functional.fractional_max_pool2d: "fractional_max_pool2d",
        _torch.nn.functional.fractional_max_pool3d: "fractional_max_pool3d",
        _torch.nn.functional.scaled_dot_product_attention: "scaled_dot_product_attention",
        _torch.nn.functional.threshold: "threshold",
        _torch.nn.functional.threshold_: "threshold_",
        _torch.nn.functional.relu: "relu",
        _torch.nn.functional.relu_: "relu_",
        _torch.nn.functional.hardtanh: "hardtanh",
        _torch.nn.functional.hardtanh_: "hardtanh_",
        _torch.nn.functional.hardswish: "hardswish",
        _torch.nn.functional.relu6: "relu6",
        _torch.nn.functional.elu: "elu",
        _torch.nn.functional.elu_: "elu_",
        _torch.nn.functional.selu: "selu",
        _torch.nn.functional.celu: "celu",
        _torch.nn.functional.leaky_relu: "leaky_relu",
        _torch.nn.functional.leaky_relu_: "leaky_relu_",
        _torch.nn.functional.prelu: "prelu",
        _torch.nn.functional.rrelu: "rrelu",
        _torch.nn.functional.rrelu_: "rrelu_",
        _torch.nn.functional.glu: "glu",
        _torch.nn.functional.gelu: "gelu",
        _torch.nn.functional.logsigmoid: "logsigmoid",
        _torch.nn.functional.hardshrink: "hardshrink",
        _torch.nn.functional.tanhshrink: "tanhshrink",
        _torch.nn.functional.softsign: "softsign",
        _torch.nn.functional.softplus: "softplus",
        _torch.nn.functional.softmin: "softmin",
        _torch.nn.functional.softmax: "softmax",
        _torch.nn.functional.softshrink: "softshrink",
        _torch.nn.functional.gumbel_softmax: "gumbel_softmax",
        _torch.nn.functional.log_softmax: "log_softmax",
        _torch.nn.functional.tanh: "tanh",
        _torch.nn.functional.sigmoid: "sigmoid",
        _torch.nn.functional.hardsigmoid: "hardsigmoid",
        _torch.nn.functional.silu: "silu",
        _torch.nn.functional.mish: "mish",
        _torch.nn.functional.batch_norm: "batch_norm",
        _torch.nn.functional.group_norm: "group_norm",
        _torch.nn.functional.instance_norm: "instance_norm",
        _torch.nn.functional.layer_norm: "layer_norm",
        _torch.nn.functional.local_response_norm: "local_response_norm",
        _torch.nn.functional.normalize: "normalize",
        _torch.nn.functional.linear: "linear",
        _torch.nn.functional.bilinear: "bilinear",
        _torch.nn.functional.dropout: "dropout",
        _torch.nn.functional.alpha_dropout: "alpha_dropout",
        _torch.nn.functional.feature_alpha_dropout: "feature_alpha_dropout",
        _torch.nn.functional.dropout1d: "dropout1d",
        _torch.nn.functional.dropout2d: "dropout2d",
        _torch.nn.functional.dropout3d: "dropout3d",
        _torch.nn.functional.embedding: "embedding",
        _torch.nn.functional.embedding_bag: "embedding_bag",
        _torch.nn.functional.one_hot: "one_hot",
        _torch.nn.functional.pairwise_distance: "pairwise_distance",
        _torch.nn.functional.cosine_similarity: "cosine_similarity",
        _torch.nn.functional.pdist: "pdist",
        _torch.nn.functional.pixel_shuffle: "pixel_shuffle",
        _torch.nn.functional.pixel_unshuffle: "pixel_unshuffle",
        _torch.nn.functional.pad: "pad",
        _torch.nn.functional.interpolate: "interpolate",
        _torch.nn.functional.upsample: "upsample",
        _torch.nn.functional.upsample_nearest: "upsample_nearest",
        _torch.nn.functional.upsample_bilinear: "upsample_bilinear",
        _torch.nn.functional.grid_sample: "grid_sample",
        _torch.nn.functional.affine_grid: "affine_grid",
        _torch.Size: "Size",
        _torch.cat: "cat",
        _torch.concat: "concat",
        _torch.flatten: "flatten",
        _torch.add: "add",
        _torch.mul: "mul",
        _torch.sub: "sub",
        _torch.div: "div",
        _torchvision.ops.stochastic_depth: "stochastic_depth",
        _torch.permute: "permute",
        _torch.swapaxes: "swapaxes",
        _torch.einsum: "einsum",
        _torch.squeeze: "squeeze",
        _torch.unsqueeze: "unsqueeze",
        _torch.floor_divide: "floor_divide",
        _torch.Tensor.size: "size",
        _torch.Tensor.view: "view",
        _torch.Tensor.contiguous: "contiguous",
        _torch.transpose: "transpose",
        _torch.chunk: "chunk",
        _torch.mean: "mean",
        _torch.eq: "eq",
        _torch.Tensor.eq: "eq",
        _torch._assert: "_assert",
        _torch.reshape: "reshape",
        _torch.Tensor.reshape: "reshape",
        _torch.Tensor.expand: "expand",
        _torch.Tensor.dim: "dim",
        _operator.add: "add",
        _operator.sub: "sub",
        _operator.mul: "mul",
        _operator.truediv: "truediv",
        _torch.Tensor.flatten: "flatten",
    }

    if target in func_map:
        return func_map[target]

    # Examples:
    # <built-in method conv2d of type object at 0x10816f290>
    # <function relu at 0x108fddbc0>
    # <function boolean_dispatch.<locals>.fn at 0x108fdc900>
    # <built-in function linear>
    # <class 'torchvision.models.googlenet.GoogLeNetOutputs'>
    tokens = str(target).split(" ")
    # Look for token after "method" or "function"
    token_keywords = (
        "method",
        "function",
        "<method",
        "<function",
        "<class",
    )
    for i in range(len(tokens)):
        token = tokens[i]
        if (token in token_keywords) and len(tokens) > i + 1:
            func_name = tokens[i + 1]
            if func_name[-1] == ">":
                func_name = func_name[:-1]
            return func_name
    return ""

    Parses the call function target for the function-name and returns it.
    Initially, will try to lookup the function inside a dictionary that maps
    known functions to function-names. If the function is not found in the dictionary,
    then will use custom parsing code to get the function-name.
    
coremltools/optimize/torch/_utils/graph_utils.py