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

p142 全てのデータ点に対する平均について #10

Open
roadto93ds opened this issue Sep 24, 2021 · 1 comment
Open

p142 全てのデータ点に対する平均について #10

roadto93ds opened this issue Sep 24, 2021 · 1 comment

Comments

@roadto93ds
Copy link

p142 にて全てのデータ点に対して平均をとる(定数で割る)とありますが、平均をとる操作はどこにあるのでしょうか。

# 初期値
w = torch.ones(())
b = torch.zeros(())
# In[14]:を別々に実行
dloss_dtp = dloss_fn(t_p, t_c) # len=11
dloss_dw = dloss_dtp * dmodel_dw(t_u, w, b) # len=11
dloss_db = dloss_dtp * dmodel_db(t_u, w, b) # len=11
torch.stack([dloss_dw.sum(), dloss_db.sum()]) # tensor([4517.2964,   82.6000])
torch.sum(dloss_dw) # 4517.2964

単純なsumを取ったものと出力が変わらなかったので、どこで平均を取るような処理がされているのか分かりませんでした。

初歩的な質問で申し訳ありませんが、回答頂けますと幸いです。
よろしくお願いいたします。

@roadto93ds
Copy link
Author

この前までのところで 1/11 された状態が続いているので、合計することで1になるということかと自己解決しました。すみません。

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