Skip to content

Commit

Permalink
Merge pull request #297 from djlouie/master
Browse files Browse the repository at this point in the history
Optimized and meticulously refined tutorial materials, meticulously crafted for comprehension and effectiveness.
  • Loading branch information
jeshraghian authored Mar 9, 2024
2 parents da5337b + 6e479b5 commit 21d8586
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/tutorials/tutorial_1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ the above technique:
rate_coded_vector = torch.bernoulli(raw_vector)

::
>>> print(f"Converted vector: {rate_coded_vector}")
Converted vector: tensor([1., 1., 1., 0., 0., 1., 1., 0., 1., 0.])
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/tutorial_7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Because event recordings have different lengths, we are going to provide a
collation function ``tonic.collation.PadTensors()`` that will pad out shorter
recordings to ensure all samples in a batch have the same dimensions.

::
::

from torch.utils.data import DataLoader
from tonic import DiskCachedDataset
Expand Down Expand Up @@ -165,6 +165,7 @@ If you have a large amount of RAM available, you can speed up dataloading furthe
by caching to main memory instead of to disk:

::
from tonic import MemoryCachedDataset

cached_trainset = MemoryCachedDataset(trainset)
Expand Down
13 changes: 7 additions & 6 deletions docs/tutorials/tutorial_stmnist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The snnTorch tutorial series is based on the following paper. If you find these

.. note::
This tutorial is a static non-editable version. Interactive, editable versions are available via the following links:
* `Google Colab <https://colab.research.google.com/github/jeshraghian/snntorch/blob/master/examples/tutorial_exoplanet_hunter.ipynb>`_
* `Google Colab <https://colab.research.google.com/github/jeshraghian/snntorch/blob/master/examples/tutorial_stmnist.ipynb>`_
* `Local Notebook (download via GitHub) <https://github.com/jeshraghian/snntorch/tree/master/examples>`_


Expand Down Expand Up @@ -131,7 +131,7 @@ with PyTorch/snnTorch. The documentation can be found

Tonic formats the STMNIST dataset into ``(x, y, t, p)`` tuples.

* ``x``is the position on the x-axis
* ``x`` is the position on the x-axis
* ``y`` is the position on the y-axis
* ``t`` is a timestamp
* ``p`` is polarity; +1 if taxel pressed down, 0 if taxel released
Expand Down Expand Up @@ -267,7 +267,8 @@ We can also use ``snntorch.spikeplot``
display(HTML(anim.to_html5_video()))

::
::

>>> Animation of ST-MNIST
>>> The target label is: 3
Expand All @@ -288,6 +289,7 @@ each: 23*30*10 = 6,900.
print(len(dataset))

::

>>> 6953

1.6 Lets create a trainset and testset!
Expand Down Expand Up @@ -604,9 +606,8 @@ single piece of data using the spike recording list.

::

from IPython.display import HTML
idx = 8
# Change index to visualize a different sample
idx = 0
fig, ax = plt.subplots(facecolor='w', figsize=(12, 7))
labels=['0', '1', '2', '3', '4', '5', '6', '7', '8','9']
print(f"The target label is: {targets[idx]}")
Expand Down
5 changes: 2 additions & 3 deletions examples/tutorial_stmnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,8 @@
},
"outputs": [],
"source": [
"from IPython.display import HTML\n",
"\n",
"idx = 8\n",
"# Change index to visualize a different sample\n",
"idx = 0\n",
"fig, ax = plt.subplots(facecolor='w', figsize=(12, 7))\n",
"labels=['0', '1', '2', '3', '4', '5', '6', '7', '8','9']\n",
"print(f\"The target label is: {targets[idx]}\")\n",
Expand Down

0 comments on commit 21d8586

Please sign in to comment.