RuntimeError: CUDA error: device-side assert triggered in multiplication process

username: Audrey
cooked: <p>Hi, I got a weird error when I ran my project. This is a brief view of my code:</p>
<pre><code class="lang-python">def __init__(self):
    ...
    self.entity_embedding = nn.Embedding(self.entity_num, self.dim)
    self.relation_embedding = nn.Embedding(self.relation_num, self.dim)

def forward(self):
    r_and_t = self.entity_embedding(relation) * self.relation_embedding(tail)
    r_and_t = torch.unsqueeze(r_and_t, dim=1)
    r_and_t = r_and_t.expand(r_and_t.shape[0], self.entity_num, self.dim)
    embed_head = self.entity_embedding.weight.expand(r_and_t.shape[0], self.entity_num, self.dim)
    print(r_and_t.shape)
    print(embed_head.shape)
    print((embed_head * r_and_t).shape)  #should get the same shape as the two above
</code></pre>
<p>Both <code>self.entity_embedding</code> and <code>self.relation_embedding</code> are nn.Embedding.</p>
<p>Everything is fine until runing process gets to the line:</p>
<pre><code class="lang-auto">print((embed_head * r_and_t).shape)
</code></pre>
<p>where I got the following information:</p>
<pre><code class="lang-auto">torch.Size([512, 14951, 100])
torch.Size([512, 14951, 100])
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [116,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [117,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [118,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [119,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [120,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [121,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [122,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [123,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [124,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [125,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [126,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [78,0,0], thread: [127,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
Traceback (most recent call last):
  File "D:/PyCharm/Projects/OpenKGRL_Pytorch/DistMult/train.py", line 96, in &lt;module&gt;
    raw_head_hits1, raw_head_hits10, raw_head_ranks = model.head_predict(data[0], data[1], data[2])
  File "D:\PyCharm\Projects\OpenKGRL_Pytorch\DistMult\distMult.py", line 47, in head_predict
    print((embed_head * r_and_t).shape)
RuntimeError: CUDA error: device-side assert triggered
</code></pre>
<p>It looks that <code>embed_head * r_and_t</code> triggers error, but obviously <code>embed_head</code> and <code>r_and_t</code> are the same shape.  In some previous similar posts people said the reason is <strong>index out of bound</strong>. But I don’t know how could it happen in a multiplication process. I still have no idea how to debug.</p>
<p>Anything I should note? Or anyone can tell me where is the possible mistakes?</p>

username: ptrblck
cooked: <p>Could you run the code with <code>CUDA_LAUNCH_BLOCKING=1 python scrit.py</code> and post the stack trace here?<br>
The current error message might point to a wrong line of code.<br>
Also, could you post the arguments and shapes of all layers and tensors, so that we could reproduce this issue?</p>

username: Audrey
cooked: <p>Thanks for your help. I added <code>os.environ['CUDA_LAUNCH_BLOCKING'] = '1'</code> in my code and ran it again. Errors occurred as following:</p>
<pre><code class="lang-auto">C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [64,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [65,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [66,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [67,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [68,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [69,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [70,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [71,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [72,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [73,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [74,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [75,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [76,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [77,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [78,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [79,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [80,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [81,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [82,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [83,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [84,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [85,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [86,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [87,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [88,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [89,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [90,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [91,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [32,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [33,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [34,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [35,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [36,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [37,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [38,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [39,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [40,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [41,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [42,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [43,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [44,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [45,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [46,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [47,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [48,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [49,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [50,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [51,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [52,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [53,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [54,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [55,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [56,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [57,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [58,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [59,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [60,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [61,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [62,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [36,0,0], thread: [63,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [96,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [97,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [98,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [99,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [100,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [101,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [102,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [103,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [104,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [105,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [106,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [107,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [108,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [109,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [110,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [111,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [112,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [113,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [114,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [115,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [0,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [1,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [2,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [3,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [4,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [5,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [6,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [7,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [8,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [9,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [10,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [11,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [12,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [13,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [14,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [15,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [16,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [17,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [18,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [19,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [20,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [21,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [22,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [23,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [24,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [25,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [26,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [27,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [28,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [29,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [30,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
C:/w/1/s/windows/pytorch/aten/src/THC/THCTensorIndex.cu:361: block: [228,0,0], thread: [31,0,0] Assertion `srcIndex &lt; srcSelectDimSize` failed.
Traceback (most recent call last):
  File "D:/PyCharm/Projects/OpenKGRL_Pytorch/DistMult/train.py", line 99, in &lt;module&gt;
    raw_head_hits1, raw_head_hits10, raw_head_ranks = model.head_predict(data[0], data[1], data[2])
  File "D:\PyCharm\Projects\OpenKGRL_Pytorch\DistMult\distMult.py", line 41, in head_predict
    r_and_t = self.entity_embedding(relation) * self.relation_embedding(tail)
RuntimeError: CUDA error: device-side assert triggered
</code></pre>
<p>This time it seems like error triggerred in line:</p>
<pre><code class="lang-auto">r_and_t = self.entity_embedding(relation) * self.relation_embedding(tail)
</code></pre>
<p>This is possible for a <strong>index out of bound</strong> mistake. I’ll check this!<br>
---------------------------------------------update--------------------------------------------------<br>
I made a super stupid mistake!</p>
<pre><code class="lang-auto">r_and_t = self.entity_embedding(relation) * self.relation_embedding(tail)
</code></pre>
<p>Obviously, I mistakenly used <code>relation</code> to look up <code>entity_embedding</code>. <img src="https://discuss.pytorch.org/images/emoji/apple/roll_eyes.png?v=9" title=":roll_eyes:" class="emoji" alt=":roll_eyes:"> and I even didn’t notice it. After correction, I could run successfully finally!<br>
Thanks for your help again!</p>