teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

エラーメッセージの追加、リンクの修正を行いました

2019/09/30 05:20

投稿

ryu1
ryu1

スコア4

title CHANGED
File without changes
body CHANGED
@@ -1,14 +1,17 @@
1
1
  ### 前提・実現したいこと
2
- http://nlp.seas.harvard.edu/2018/04/03/attention.html
2
+ [こちら](http://nlp.seas.harvard.edu/2018/04/03/attention.html)の解説記事のソースコードを実行しようと試みましたができない
3
- こちらの解説記事のソースコードを実行しようと試みましたができない
4
3
 
5
4
 
6
5
  ### 発生している問題・エラーメッセージ
7
6
  positional encodingの部分でエラーが起きているっぽい
8
7
  ```
8
+ Traceback (most recent call last):
9
+ File "C:../..", line 245, in <module>
9
- tmp_model = make_model(10, 10, 2)
10
+ tmp_model = make_model(10, 10, 2)
11
+ File "C:../..", line 228, in make_model
10
- position = PositionalEncoding(d_model, dropout)
12
+ position = PositionalEncoding(d_model, dropout)
13
+ File "C:../..", line 212, in __init__
11
- pe[:, 0::2] = torch.sin(position * div_term)
14
+ pe[:, 0::2] = torch.sin(position * div_term)
12
15
  RuntimeError: expected device cpu and dtype Float but got device cpu and dtype Long
13
16
  ```
14
17
 
@@ -65,11 +68,21 @@
65
68
  ### 試したこと
66
69
 
67
70
  解説記事のプログラムをそのまま実行すると別のエラー(RuntimeError: exp_vml_cpu not implemented for 'Long')が出ていたので
71
+ ```
72
+ Traceback (most recent call last):
73
+ File "C:../..", line 245, in <module>
74
+ tmp_model = make_model(10, 10, 2)
75
+ File "C:../..", line 228, in make_model
76
+ position = PositionalEncoding(d_model, dropout)
77
+ File "C:../..", line 211, in __init__
78
+ -(math.log(10000.0) / d_model))
79
+ RuntimeError: exp_vml_cpu not implemented for 'Long'
80
+ ```
68
81
 
69
- https://discuss.pytorch.org/t/runtimeerror-exp-vml-cpu-not-implemented-for-long/49025
70
82
 
71
- こちらを参考に0に小数点を付けました
72
83
 
84
+ [こちら](https://discuss.pytorch.org/t/runtimeerror-exp-vml-cpu-not-implemented-for-long/49025)を参考に0に小数点を付けました
85
+
73
86
  ### 補足情報
74
87
 
75
88
  python 3.5.4