tfep.nn.graph.compute_edge_distances
- tfep.nn.graph.compute_edge_distances(x, edges, normalize_directions=False, inverse_directions=False)[source]
Return distances between nodes across edges.
- Parameters:
x (torch.Tensor) – Positions of particles with shape (batch_size*n_nodes, 3).
edges (torch.Tensor) – Shape
(2, batch_size*n_edges). Thei-th edge is created from nodeedges[0][i]toedges[1][i], whereedges[0][i]is a node index in the range[0, batch_size*n_nodes].normalize_directions (bool, optional) – If
True, the returned directions are normalized by their norms.inverse_directions (bool, optional) – If
True, the direction vectors go from the destination node to the source node rather than the opposite.
- Returns:
distances (torch.Tensor) – Shape
(batch_size*n_edges,).distances[i]is the distance between the nodes of thei-th edge.direction (torch.Tensor) – Shape
(batch_size*n_edges, 3).direction[i]is the vector connecting the nodes of thei-th edge. The vectors are normalized by their norms ifnormalize_directionisTrue.