Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p. 92 예제 2.15의 디코더 구현에서 문의드립니다. #21

Open
1taehyeok opened this issue Dec 14, 2024 · 0 comments
Open

p. 92 예제 2.15의 디코더 구현에서 문의드립니다. #21

1taehyeok opened this issue Dec 14, 2024 · 0 comments

Comments

@1taehyeok
Copy link

1taehyeok commented Dec 14, 2024

책에 코드가 아래처럼 되어 있는데
output = mod(output,src)가 아니고 output = mod(tgt,src)로 해도 어떻게 정상적으로 동작할 수 있나요??
(오타인거 같기도 해서 문의드립니다.)

import copy
def get_clones(module, N):
return nn.ModuleList([copy.deepcopy(module) for i in range(N)])

class TransformerDecoder(nn.Module):
def init(self,decoder_layer,num_layers):
super().init()
self.layers = get_clones(decoder_layer, num_layers)
self.num_layers = num_layers

def forward(self, tgt, src):
	output = tgt
	for mod in self.layers:
		output = mod(tgt,src)
	return output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant