Updates (09/2025): We have integrated the GyroBN implementations into a toolbox, now supporting seven geometries:
- ONB Grassmannian;
- Constant curvature spaces (Poincaré ball, hyperboloid, Beltrami–Klein, sphere, projected hypersphere);
- Full-rank correlation manifolds (Poly-Hyperbolic-Cholesky metric).
The complete implementations can be found in the GyroBN folder. This toolbox is designed to be plug-and-play, making it easy to apply GyroBN as a drop-in normalization module across different neural architectures.
This is the official code for our ICLR 2025 publication: Gyrogroup Batch Normalization.
If you find this project helpful, please consider citing us as follows:
@inproceedings{chen2025gyrobn,
title={Gyrogroup Batch Normalization},
author={Ziheng Chen and Yue Song and Xiaojun Wu and Nicu Sebe},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025}
}As discussed in our main paper, GyroBN also naturally incorporates our previous LieBN:
@inproceedings{chen2024liebn,
title={A Lie Group Approach to Riemannian Batch Normalization},
author={Ziheng Chen and Yue Song and Yunmei Liu and Nicu Sebe},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
}If you have any problem, please contact me via ziheng_ch@163.com.
This source code contains GyroBN on the Grassmannian and hyperbolic spaces. We also implemented RBN and ManifoldNorm on the Grassmannian, as shown in Tab. 3.
Install necessary dependencies by conda:
conda env create --file environment.yaml
Note that the hydra package is used to manage configuration files.
Demos of Grassmannian and hyperbolic GyroBN, which can be found in demo.py:
import torch as th
from RieNets.grnets.GrBN import GyroBNGr
from Geometry.Grassmannian import GrassmannianGyro
from RieNets.hnns.layers.GyroBNH import GyroBNH
from frechetmean import Poincare
# --- Typical use of Grassmannian GyroBN
bs, c, n, p = 32, 8, 30, 10
grassmannian = GrassmannianGyro(n=n, p=p)
random_data = grassmannian.random(bs, c, n, p)
rbn = GyroBNGr(shape=[c, n, p])
output_grassmann = rbn(random_data)
# --- Typical use of hyperbolic GyroBN in the Poincaré ball
random_euclidean_vectors = th.randn(bs, n)/10
poincare_ball = Poincare()
random_hyperbolic_data = poincare_ball.projx(random_euclidean_vectors) # Generate random points in the Poincaré ball
rbn_h = GyroBNH(dim=n,manifold=poincare_ball) # Initialize GyroBNH for hyperbolic normalization
output_hyperbolic = rbn_h(random_hyperbolic_data) # Apply GyroBNH
# Print shape to verify outputs
print("Grassmannian BN output shape:", output_grassmann.shape)
print("Hyperbolic BN output shape:", output_hyperbolic.shape)The preprocessed Grassmannian from the HDM05 dataset can be found here.
The link prediction datasets can be found here.
Please download the datasets and put them in your folder.
If necessary, change the path in conf/dataset/HDM05.yaml and conf/dataset/LP.yaml,
Please run this command for the main experiments on the HDM05 (Tab. 3):
bash exp_grassmannian.sh
Please run this command for the KBlock ablations on the HDM05 (Tab. 4):
bash exp_grassmannian_ablations.sh
The tensorboard results on the HDM05 under 1-block architecture:
Note: You can change the path in exp_xxx.sh, which will override the hydra config.
Please run this command for HNN with or without GyroBN-H or RBN-H on the link prediction task. (Tab. 5):
bash exp_hyperbolic.sh
ROC on three typical link prediction datasets:
Visualization code can be found in ./Visualization/gyrobn_gras_hyperbolic.py, corresponding to Fig. 1.



