Skip to content

Commit

Permalink
re-run notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
loreloc committed Dec 12, 2024
1 parent 75b0de3 commit 4fa4153
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 307 deletions.
18 changes: 9 additions & 9 deletions notebooks/compilation-options.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 4.58 s, sys: 1.02 s, total: 5.6 s\n",
"Wall time: 5.52 s\n"
"CPU times: user 4.78 s, sys: 1.14 s, total: 5.92 s\n",
"Wall time: 5.76 s\n"
]
}
],
Expand Down Expand Up @@ -273,7 +273,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1.26 s ± 19.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
"1.29 s ± 21.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n"
]
}
],
Expand Down Expand Up @@ -338,8 +338,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 4.6 s, sys: 989 ms, total: 5.59 s\n",
"Wall time: 5.52 s\n"
"CPU times: user 4.68 s, sys: 915 ms, total: 5.6 s\n",
"Wall time: 5.54 s\n"
]
}
],
Expand Down Expand Up @@ -433,7 +433,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"58.9 ms ± 22.1 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
"58.9 ms ± 28.8 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
Expand Down Expand Up @@ -527,8 +527,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 4.97 s, sys: 962 ms, total: 5.93 s\n",
"Wall time: 5.86 s\n"
"CPU times: user 4.55 s, sys: 758 ms, total: 5.31 s\n",
"Wall time: 5.25 s\n"
]
}
],
Expand Down Expand Up @@ -591,7 +591,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"25.6 ms ± 4.2 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
"25.7 ms ± 27.3 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
Expand Down
32 changes: 16 additions & 16 deletions notebooks/learning-a-circuit-with-pic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"metadata": {},
"outputs": [],
"source": [
"from cirkit.templates import circuit_templates\n",
"from cirkit.templates import utils, data_modalities\n",
"from cirkit.pipeline import compile\n",
"import random\n",
"import numpy as np\n",
Expand All @@ -45,14 +45,14 @@
"# Set the torch device to use\n",
"device = torch.device('cuda')\n",
"\n",
"symbolic_circuit = circuit_templates.image_data(\n",
"symbolic_circuit = data_modalities.image_data(\n",
" (1, 28, 28), # The shape of MNIST image, i.e., (num_channels, image_height, image_width)\n",
" region_graph='quad-graph', # Select the structure of the circuit to follow the QuadGraph region graph\n",
" input_layer='categorical', # Use Categorical distributions for the pixel values (0-255) as input layers\n",
" num_input_units=64, # Each input layer consists of 64 Categorical input units\n",
" sum_product_layer='cp', # Use CP sum-product layers, i.e., alternate dense sum layers and hadamard product layers\n",
" num_sum_units=64, # Each dense sum layer consists of 64 sum units\n",
" sum_weight_param=circuit_templates.Parameterization(\n",
" sum_weight_param=utils.Parameterization(\n",
" activation='none', # Do not use any parameterization\n",
" initialization='normal' # Initialize the sum weights by sampling from a standard normal distribution\n",
" )\n",
Expand Down Expand Up @@ -327,17 +327,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Step 200: Average NLL: 801.153\n",
"Step 400: Average NLL: 707.815\n",
"Step 600: Average NLL: 686.067\n",
"Step 800: Average NLL: 677.673\n",
"Step 1000: Average NLL: 664.983\n",
"Step 1200: Average NLL: 656.790\n",
"Step 1400: Average NLL: 653.522\n",
"Step 1600: Average NLL: 651.386\n",
"Step 1800: Average NLL: 650.300\n",
"Step 2000: Average NLL: 648.279\n",
"Step 2200: Average NLL: 647.581\n"
"Step 200: Average NLL: 800.724\n",
"Step 400: Average NLL: 704.707\n",
"Step 600: Average NLL: 684.442\n",
"Step 800: Average NLL: 675.654\n",
"Step 1000: Average NLL: 666.133\n",
"Step 1200: Average NLL: 656.394\n",
"Step 1400: Average NLL: 653.244\n",
"Step 1600: Average NLL: 651.271\n",
"Step 1800: Average NLL: 650.399\n",
"Step 2000: Average NLL: 648.530\n",
"Step 2200: Average NLL: 647.928\n"
]
}
],
Expand Down Expand Up @@ -393,8 +393,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Average test LL: -642.370\n",
"Bits per dimension: 1.182\n"
"Average test LL: -642.912\n",
"Bits per dimension: 1.183\n"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions notebooks/learning-a-circuit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 3.18 s, sys: 267 ms, total: 3.45 s\n",
"Wall time: 3.4 s\n"
"CPU times: user 2.65 s, sys: 322 ms, total: 2.97 s\n",
"Wall time: 2.89 s\n"
]
}
],
Expand Down
Loading

0 comments on commit 4fa4153

Please sign in to comment.