MCPcopy Create free account
hub / github.com/DeepGraphLearning/DiffPack / __init__

Method __init__

diffpack/layer.py:15–28  ·  view source on GitHub ↗
(self, input_dim, hidden_dims, sigma_dim, embed_type="sinusoidal",
                 operation="post_add")

Source from the content-addressed store, hash-verified

13@R.register("layers.SigmaEmbeddingLayer")
14class SigmaEmbeddingLayer(nn.Module, core.Configurable):
15 def __init__(self, input_dim, hidden_dims, sigma_dim, embed_type="sinusoidal",
16 operation="post_add"):
17 super(SigmaEmbeddingLayer, self).__init__()
18 self.input_dim = input_dim
19 self.hidden_dims = hidden_dims
20 self.output_dim = hidden_dims[-1]
21 self.sigma_dim = sigma_dim
22 self.embed_func = get_timestep_embedding(embed_type, sigma_dim)
23 self.operation = operation
24 if self.operation == "post_add":
25 self.sigma_linear = nn.Linear(sigma_dim, hidden_dims[-1])
26 self.mlp = layers.MLP(input_dim, hidden_dims, short_cut=True)
27 elif self.operation == "pre_concat":
28 self.mlp = layers.MLP(input_dim + sigma_dim, hidden_dims, short_cut=True)
29
30 def forward(self, input, sigma):
31 sigma_embed = self.embed_func(sigma)

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 1

get_timestep_embeddingFunction · 0.85

Tested by

no test coverage detected