| 962 | self.enable_cfattn(attn_mask) |
| 963 | |
| 964 | def forward(self, context): |
| 965 | if self.store: |
| 966 | self.stored_attn["decoder_attn"].append(context.detach()) |
| 967 | if self.use_intraattn and len(self.stored_attn["decoder_attn"]) > 0: |
| 968 | tmp = self.stored_attn["decoder_attn"][self.index] |
| 969 | self.index = self.index + 1 |
| 970 | if self.index >= len(self.stored_attn["decoder_attn"]): |
| 971 | self.index = 0 |
| 972 | self.disable_store() |
| 973 | return tmp |
| 974 | return context |
| 975 | |
| 976 | def __call__(self, context): |
| 977 | context = self.forward(context) |