cvlab-columbia / hyperfuture

Code for the paper Learning the Predictability of the Future (CVPR 2021)
https://hyperfuture.cs.columbia.edu/
MIT License
161 stars 25 forks source link

Code implementation for hyperbolic layers #5

Closed guikunchen closed 1 year ago

guikunchen commented 1 year ago

The released hyperbolic modules performs exp_0 after linear layer in Euclidean space, which may be contrary to the illustration of Figure 3.

image

It seems that there is not hyperbolic linear layes after $exp_0$, i.e., the h module in the left of exp_0.

surisdi commented 1 year ago

Hi,

The line of code you link is not the full linear layer. The full linear layer is the whole mobius_linear operation. The practical way of doing the linear layer operation in hyperbolic space, as explained in this paper (Section 3.2) is to do a logarithmic mapping to the tangent space (Euclidean space), then performing a matrix multiplication in that space (line of code you link to -- which doesn't contain the bias addition), followed by an exponential mapping to the hyperbolic space again, and finally an addition of the bias (in hyperbolic space). That is the complete "linear layer".

When the input happens to already be in the tangent (Euclidean) space, the first logarithmic mapping is not necessary. You can understand it as first performing the exponential mapping in the figure, and then a logarithmic mapping to invert it.

Let me know if you have any more questions.