{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Estimate Neural Manifold Curvature"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Set-up + Imports"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Working directory: /home/facosta/neurometry/neurometry\n",
"Directory added to path: /home/facosta/neurometry\n",
"Directory added to path: /home/facosta/neurometry/neurometry\n"
]
},
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import setup\n",
"\n",
"setup.main()\n",
"%load_ext autoreload\n",
"%autoreload 2\n",
"%load_ext jupyter_black\n",
"\n",
"import os\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import torch\n",
"\n",
"os.environ[\"GEOMSTATS_BACKEND\"] = \"pytorch\"\n",
"import geomstats.backend as gs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load config & model"
]
},
{
"cell_type": "code",
"execution_count": 89,
"metadata": {},
"outputs": [],
"source": [
"run_name = \"run_6rixqmzt_t2_synthetic_noise_var_1e-05_embedding_dim_3\""
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [],
"source": [
"results_dir = os.path.join(os.getcwd(), \"curvature/results\")\n",
"models_dir = os.path.join(results_dir, \"trained_models\")\n",
"configs_dir = os.path.join(results_dir, \"configs\")\n",
"\n",
"\n",
"import json\n",
"\n",
"model_file = os.path.join(models_dir, f\"{run_name}_model.pt\")\n",
"config_file = os.path.join(configs_dir, f\"{run_name}.json\")\n",
"\n",
"with open(config_file, \"r\") as file:\n",
" config_dict = json.load(file)\n",
"\n",
"\n",
"class Config:\n",
" def __init__(self, config_dict):\n",
" self.__dict__.update(config_dict)\n",
"\n",
" def __getattr__(self, name):\n",
" if name in self:\n",
" return self[name]\n",
" else:\n",
" raise AttributeError(\n",
" f\"'{self.__class__.__name__}' object has no attribute '{name}'\"\n",
" )\n",
"\n",
"\n",
"config = Config(config_dict)"
]
},
{
"cell_type": "code",
"execution_count": 94,
"metadata": {},
"outputs": [],
"source": [
"import neurometry.curvature.models.toroidal_vae as toroidal_vae\n",
"\n",
"\n",
"model = toroidal_vae.ToroidalVAE(\n",
" data_dim=config.data_dim,\n",
" latent_dim=config.latent_dim,\n",
" sftbeta=config.sftbeta,\n",
" encoder_width=config.encoder_width,\n",
" encoder_depth=config.encoder_depth,\n",
" decoder_width=config.decoder_width,\n",
" decoder_depth=config.decoder_depth,\n",
" posterior_type=config.posterior_type,\n",
").to(config.device)\n",
"\n",
"\n",
"# model.load_state_dict(torch.load(model_file))\n",
"# model.eval();\n",
"\n",
"model = torch.load(model_file)\n",
"model.eval();"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Compute extrinsic curvature"
]
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"torch.Size([100, 2])\n",
"An error occurred for i=0: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=1: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=2: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=3: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=4: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=5: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=6: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=7: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=8: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=9: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=10: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=11: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=12: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=13: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=14: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=15: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=16: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=17: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=18: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=19: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.3398, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=20: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=21: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=22: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=23: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=24: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=25: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=26: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=27: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=28: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=29: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[2.8585, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=30: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=31: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=32: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=33: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=34: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=35: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=36: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=37: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=38: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=39: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[9.6676, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=40: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=41: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=42: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=43: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=44: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=45: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=46: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=47: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=48: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=49: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[10.4394, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=50: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=51: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=52: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=53: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=54: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=55: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=56: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=57: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=58: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=59: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[24.1509, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=60: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=61: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=62: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=63: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=64: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=65: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=66: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=67: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=68: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=69: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[14.2595, 0.0000],\n",
" [ 0.0000, 0.0000]])\n",
"An error occurred for i=70: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=71: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=72: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=73: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=74: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=75: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=76: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=77: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=78: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=79: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.6733, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=80: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=81: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=82: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=83: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=84: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=85: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=86: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=87: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=88: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=89: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[6.9866, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=90: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=91: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=92: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=93: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=94: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=95: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=96: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=97: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=98: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"An error occurred for i=99: linalg.inv: The diagonal element 2 is zero, the inversion could not be completed because the input matrix is singular.\n",
"tensor([[3.5656, 0.0000],\n",
" [0.0000, 0.0000]])\n",
"Computation time: 1.080 seconds.\n"
]
}
],
"source": [
"import neurometry.curvature.evaluate as evaluate\n",
"\n",
"z_grid, geodesic_dist, _, curv_norms_learned = evaluate.compute_curvature_learned(\n",
" model=model,\n",
" config=config,\n",
" embedding_dim=config.embedding_dim,\n",
" n_grid_points=config.n_grid_points,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "neurometry",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}