def _get_layer_information(model, layer_name):
    """
    Get the layer name, layer dtype and layer shape in the graph of ONNX model by the layer name
    :param model: the ONNX model of PyTorch
    :param layer_name: the layer name of ONNX model
    :return: the name, dtype, shape of layer
    """

    # type_table come from onnx-ml.proto: https://github.com/onnx/onnx/blob/master/onnx/onnx-ml.proto
    type_table = {0: 'UNDEFINED', 1: 'FLOAT', 2: 'INT', 3: 'STRING', 4: 'TENSOR', 5: 'GRAPH', 6: 'FLOATS',
                  7: 'INT', 8: 'STRINGS', 9: 'TENSORS', 10: 'GRAPHS'}

    layer_information = list(model.graph.value_info)
    layer_information.append(model.graph.input[0])
    layer_information.append(model.graph.output[0])
    layer_information_table = {item.name: item for item in layer_information}

    if layer_name in layer_information_table:
        item = layer_information_table[layer_name]
        elem_type = item.type.tensor_type.elem_type
        layer_dim = item.type.tensor_type.shape.dim
        layer_dtype = type_table[elem_type]
        layer_shape = [i.dim_value for i in layer_dim]
        return item.name, layer_shape[1:], layer_dtype, elem_type
    else:
        raise Exception('The layer name: {} is not in the model'.format(layer_name))