MCPcopy Create free account
hub / github.com/MotrixLab/insactor / DecoderLayer

Class DecoderLayer

diffplanner/models/transformers/diffusion_transformer.py:77–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76
77class DecoderLayer(nn.Module):
78
79 def __init__(self,
80 sa_block_cfg=None,
81 ca_block_cfg=None,
82 ffn_cfg=None):
83 super().__init__()
84 self.sa_block = build_attention(sa_block_cfg)
85 self.ca_block = build_attention(ca_block_cfg)
86 self.ffn = FFN(**ffn_cfg)
87
88 def forward(self, **kwargs):
89 if self.sa_block is not None:
90 x = self.sa_block(**kwargs)
91 kwargs.update({'x': x})
92 if self.ca_block is not None:
93 x = self.ca_block(**kwargs)
94 kwargs.update({'x': x})
95 if self.ffn is not None:
96 x = self.ffn(**kwargs)
97 return x
98
99
100class DiffusionTransformer(BaseModule, metaclass=ABCMeta):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected