Hi, I saw your code with comments like "starting from 0 is a bad idea". Why is that so?
Based on my experience, starting from 1 will cause pretty many problems:
TransE.cpp (mentioned by you) will have segmentation fault if starting from 1, which will be solved by starting from 0
enumerate() starts from 0, however, some parts of the code doesn't handle it and causes KeyError
I am not quite sure if the model.py can run successfully, because the embedding layer takes the input with the dimension of (number of entities/relations, ); but without (number of entities/relations+1, ), out-of-range problem will raise.
For question 3., I tried "+1", but pred = x + self.b.expand_as(x) will give the error: RuntimeError: The expanded size of the tensor (14542) must match the existing size (14541) at non-singleton dimension 1. Target sizes: [128, 14542]. Tensor sizes: [14541] python-BaseException
Why indexing entities and relations from 0 is a bad idea?
Hi, I saw your code with comments like "starting from 0 is a bad idea". Why is that so? Based on my experience, starting from 1 will cause pretty many problems:
enumerate()
starts from 0, however, some parts of the code doesn't handle it and causes KeyErrormodel.py
can run successfully, because the embedding layer takes the input with the dimension of(number of entities/relations, )
; but without(number of entities/relations+1, )
, out-of-range problem will raise.pred = x + self.b.expand_as(x)
will give the error:RuntimeError: The expanded size of the tensor (14542) must match the existing size (14541) at non-singleton dimension 1. Target sizes: [128, 14542]. Tensor sizes: [14541] python-BaseException
Why indexing entities and relations from 0 is a bad idea?