I am not getting the embedding tensor result with in the 0 and 1, and one more doubt which i am having that, if we reduce the dimensions of each edge features will it reduce the original attribute features, or the original feature was not change?.

# Mapping dictionaries for categorical variables
device_type_mapping = {'NMOS': 0, 'PMOS': 1, 'R': 2, 'L': 3, 'C': 4, 'I': 5, 'V': 6}
device_mapping = {'M0': 0, 'M1': 1, 'M2': 2, 'M3': 3, 'M4': 4, 'M5': 5, 'M6': 6, 'M7': 7,
                  'C0': 8, 'C1': 9, 'R0': 10, 'L0': 11, 'I0': 12, 'V0': 13, 'V1': 14}
terminal_mapping = {'D0': 0, 'G0': 1, 'S0': 2, 'B0': 3, 'D1': 4, 'G1': 5, 'S1': 6, 'B1': 7,
                    'D2': 8, 'G2': 9, 'S2': 10, 'B2': 11, 'D3': 12, 'G3': 13, 'S3': 14, 'B3': 15,
                    'D4': 16, 'G4': 17, 'S4': 18, 'B4': 19, 'D5': 20, 'G5': 21, 'S5': 22, 'B5': 23,
                    'D6': 24, 'G6': 25, 'S6': 26, 'B6': 27, 'D7': 28, 'G7': 29, 'S7': 30, 'B7': 31,
                    'C0': 32, 'C1': 33, 'R0': 34, 'L0': 35, 'I0': 36, 'V0': 37, 'V1': 38}
edge_colors_mapping = {'blue': 0, 'red': 1, 'green': 2, 'grey': 3, 'yellow': 4, 'black': 5}
parallel_edges_mapping = {'T': 0, 'F': 1}
net_mapping = {'net1': 0, 'net2': 1, 'net3': 2, 'IN1': 3, 'IN2': 4, 'VOUT': 5, 'Vbias': 6, '0': 7, 'vdd!': 8}

# Define the embedding dimensions for each edge feature
device_type_embedding_dim = 4
device_embedding_dim = 6
net_embedding_dim = 4
terminal_name_embedding_dim = 10
edge_pairs_embedding_dim = 15
edge_colors_embedding_dim = 4
parallel_edges_embedding_dim = 1

# Create embedding layers for each edge feature
device_type_embedding = nn.Embedding(num_embeddings=7, embedding_dim=device_type_embedding_dim)
device_embedding = nn.Embedding(num_embeddings=15, embedding_dim=device_embedding_dim)
net_embedding = nn.Embedding(num_embeddings=9, embedding_dim=net_embedding_dim)
terminal_name_embedding = nn.Embedding(num_embeddings=39, embedding_dim=terminal_name_embedding_dim)
edge_pairs_embedding = nn.Embedding(num_embeddings=40, embedding_dim=edge_pairs_embedding_dim)
edge_colors_embedding = nn.Embedding(num_embeddings=6, embedding_dim=edge_colors_embedding_dim)
parallel_edges_embedding = nn.Embedding(num_embeddings=2, embedding_dim=parallel_edges_embedding_dim)


# Function to map categorical values to numerical indices
def map_categorical_to_index(feature_value, mapping_dict):
    if feature_value in mapping_dict:
        return mapping_dict[feature_value]
    else:
        return -1  # Handle unknown values

# Function to create embeddings for edge features
def get_edge_embeddings(edge_features):
    embeddings = []
    for edge in edge_features:
        device_type_index = map_categorical_to_index(edge['device_type'], device_type_mapping)

        device_index = map_categorical_to_index(edge['device'], device_mapping)

        terminal_index = map_categorical_to_index(edge['terminal_name'], terminal_mapping)

        net_index = map_categorical_to_index(edge['nets'], net_mapping)

        net_embed = net_embedding(torch.tensor(net_index))        

        edge_colors_index = map_categorical_to_index(edge['edge_colors'], edge_colors_mapping)

        parallel_edges_index = map_categorical_to_index(edge['Parallel edges present'], parallel_edges_mapping)
        
        device_type_embed = device_type_embedding(torch.tensor(device_type_index))
        device_embed = device_embedding(torch.tensor(device_index))
        terminal_name_embed = terminal_name_embedding(torch.tensor(terminal_index))
        edge_colors_embed = edge_colors_embedding(torch.tensor(edge_colors_index))
        parallel_edges_embed = parallel_edges_embedding(torch.tensor(parallel_edges_index))
        edge_pair_embed = torch.cat([device_embed, net_embed], dim=0)
        edge_embed = torch.cat([device_type_embed, device_embed, terminal_name_embed, edge_colors_embed, parallel_edges_embed, edge_pair_embed], dim=0)
        embeddings.append(edge_embed)
    
    return embeddings