I got the impression, I am interpreting the function wrong. A hint would be appreciated.
Running the unit-test, I get stuck with “Submatrices of odd and even columns must be equal” . I cannot understand why that would be the case. As far as I understand: pos/(10000^((2i)/d))* :
Since the shape is meant is to be (4, 16), columns should refer to increasing values of i, which are increasing the power of 10.000, decreasing the overall values and therefore should not be be equal to one another. Even columns should refer to even i and vica versa for odd columns. Therefore even columns should contain less numbers after the decimal place than odd ones. I.e for i= 2, I get a the vector (0, 0.1 ,0.2, 0.,3), for i=1 , I get (0, 0.316…, 0.632…, 0.948…)…
I am even further puzzled, when I ignore that test and look at this test:
limit = (position - 1) / np.power(10000,14.0/16.0) assert np.isclose(result[position - 1, d_model -1], limit ), f"Last value must be {limit}"
Where this calculation refers to me to a function as follows: pos/1000^((i-1)/d) , since my last value for position is 3 and for i is 15. The last value of my calculated array would correspond therefore to: (position - 1) / np.power(10000,(15.0*2)/16.0)
However, changing the function to the one deduced from the second mentioned test: pos/1000^((i-1)/d) does not fix the equal column problem either…
So I am a bit in limbo here.