MCPcopy Create free account
hub / github.com/DeepGraphLearning/S3F / tuple_cat

Function tuple_cat

s3f/gvp_layer.py:18–29  ·  view source on GitHub ↗

Concatenates any number of tuples (s, V) elementwise. :param dim: dimension along which to concatenate when viewed as the `dim` index for the scalar-channel tensors. This means that `dim=-1` will be applied as `dim=-2` for the vector-chan

(*args, dim=-1)

Source from the content-addressed store, hash-verified

16
17
18def tuple_cat(*args, dim=-1):
19 '''
20 Concatenates any number of tuples (s, V) elementwise.
21
22 :param dim: dimension along which to concatenate when viewed
23 as the `dim` index for the scalar-channel tensors.
24 This means that `dim=-1` will be applied as
25 `dim=-2` for the vector-channel tensors.
26 '''
27 dim %= len(args[0][0].shape)
28 s_args, v_args = list(zip(*args))
29 return torch.cat(s_args, dim=dim), torch.cat(v_args, dim=dim)
30
31
32def tuple_index(x, idx):

Callers 1

messageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected