Repository: srush/Transformer-Puzzles
Branch: main
Commit: 7178a69b363e
Files: 4
Total size: 115.6 KB
Directory structure:
gitextract_c6so92vp/
├── .gitignore
├── LICENSE
├── README.md
└── TransformerPuzzlers.ipynb
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 Sasha Rush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Transformer Puzzles
<a target="_blank" href="https://colab.research.google.com/github/srush/Transformer-Puzzles/blob/main/TransformerPuzzlers.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
</a>
<!-- #region id="e9e822cb" -->
This notebook is a collection of short coding puzzles based on the internals of the Transformer. The puzzles are written in Python and can be done in this notebook. After completing these you will have a much better intutive sense of how a Transformer can compute certain logical operations.
These puzzles are based on [Thinking Like Transformers](https://arxiv.org/pdf/2106.06981.pdf) by Gail Weiss, Yoav Goldberg, Eran Yahav and derived from this [blog post](https://srush.github.io/raspy/).
<!-- #endregion -->

<!-- #region id="8e962052" -->
## Goal
**Can we produce a Transformer that does basic elementary school addition?**
i.e. given a string "19492+23919" can we produce the correct output?
<!-- #endregion -->
<!-- #region id="d332140b" -->
## Rules
Each exercise consists of a function with a argument `seq` and output `seq`. Like a transformer we cannot change length. Operations need to act on the entire sequence in parallel. There is a global `indices` which tells use the position in the sequence. If we want to do something different on certain positions we can use `where` like in Numpy or PyTorch. To run the seq we need to give it an initial input.
<!-- #endregion -->
```python colab={"base_uri": "https://localhost:8080/", "height": 96} id="1b28dc98" outputId="f1ac1157-3db8-40c0-dbb2-7d9bad8943a0"
def even_vals(seq=tokens):
"Keep even positions, set odd positions to -1"
x = indices % 2
# Note that all operations broadcast so you can use scalars.
return where(x == 0, seq, -1)
seq = even_vals()
# Give the initial input tokens
seq.input([0,1,2,3,4])
```
<!-- #region id="9dc23f88" -->
The main operation you can use is "attention". You do this by defining a selector which forms a matrix based on `key` and `query`.
<!-- #endregion -->
```python colab={"base_uri": "https://localhost:8080/", "height": 176} id="e2ee0ff8" outputId="a61ac19c-2550-4f3c-d653-50c323cdfd59"
before = key(indices) < query(indices)
before
```
<!-- #region id="a4de0a14" -->
We can combine selectors with logical operations.
<!-- #endregion -->
```python colab={"base_uri": "https://localhost:8080/", "height": 201} id="c315ba6d" outputId="270d50fa-649c-438b-8606-d3d078478162"
before_or_same = before | (key(indices) == query(indices))
before_or_same
```
<!-- #region id="00bc66a3" -->
Once you have a selector, you can apply "attention" to sum over the grey positions. For example to compute cumulative such we run the following function.
<!-- #endregion -->
```python colab={"base_uri": "https://localhost:8080/", "height": 326} id="e79c8c8b" outputId="44db7f90-502d-497c-c5ba-4062c09f0a9a"
def cumsum(seq=tokens):
return before_or_same.value(seq)
seq = cumsum()
seq.input([0, 1, 2, 3, 4])
```
Good luck!
================================================
FILE: TransformerPuzzlers.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/srush/Transformer-Puzzles/blob/main/TransformerPuzzlers.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"id": "f8117f57",
"metadata": {
"id": "f8117f57"
},
"source": [
"# Transformer Puzzles"
]
},
{
"cell_type": "markdown",
"id": "e9e822cb",
"metadata": {
"id": "e9e822cb"
},
"source": [
"This notebook is a collection of short coding puzzles based on the internals of the Transformer. The puzzles are written in Python and can be done in this notebook. After completing these you will have a much better intutive sense of how a Transformer can compute certain logical operations. \n",
"\n",
"These puzzles are based on [Thinking Like Transformers](https://arxiv.org/pdf/2106.06981.pdf) by Gail Weiss, Yoav Goldberg, Eran Yahav and derived from this [blog post](https://srush.github.io/raspy/)."
]
},
{
"cell_type": "markdown",
"id": "8e962052",
"metadata": {
"id": "8e962052"
},
"source": [
"## Goal\n",
"\n",
"**Can we produce a Transformer that does basic addition?**\n",
"\n",
"i.e. given a string \"19492+23919\" can we produce the correct output? "
]
},
{
"cell_type": "markdown",
"id": "d332140b",
"metadata": {
"id": "d332140b"
},
"source": [
"## Rules\n",
"\n",
"Each exercise consists of a function with a argument `seq` and output `seq`. Like a transformer we cannot change length. Operations need to act on the entire sequence in parallel. There is a global `indices` which tells use the position in the sequence. If we want to do something different on certain positions we can use `where` like in Numpy or PyTorch. To run the seq we need to give it an initial input. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6c5c885a",
"metadata": {
"id": "6c5c885a"
},
"outputs": [],
"source": [
"%%capture\n",
"!pip install -qqq git+https://github.com/chalk-diagrams/chalk git+https://github.com/srush/RASPy "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "51724e11",
"metadata": {
"id": "51724e11"
},
"outputs": [],
"source": [
"from IPython.display import display, HTML\n",
"from raspy import key, query, tokens, indices, where, draw\n",
"import random"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1b28dc98",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 96
},
"id": "1b28dc98",
"outputId": "f1ac1157-3db8-40c0-dbb2-7d9bad8943a0"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[0, -1, 2, -1, 4]"
],
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<svg baseProfile=\"full\" height=\"75.0\" version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><marker id=\"arrow\" markerHeight=\"3.5\" markerWidth=\"5\" orient=\"auto\" refX=\"5.0\" refY=\"1.7\"><polygon points=\"0,0 5,1.75 0,3.5\" /></marker></defs><g style=\"fill:white;\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 100.0, 37.5)\"><g transform=\"matrix(23.809523809523807, 0.0, 0.0, 23.809523809523807, 0.0, 0.0)\"><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -2.5, -1.0)\"><g><g><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Input</text></g><g /></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.0)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Final</text></g><g /></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">-1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">-1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g></g><g /></g></g></g></g></svg>"
},
"metadata": {},
"execution_count": 3
}
],
"source": [
"def even_vals(seq=tokens):\n",
" \"Keep even positions, set odd positions to -1\"\n",
" x = indices % 2\n",
" # Note that all operations broadcast so you can use scalars.\n",
" return where(x == 0, seq, -1)\n",
"seq = even_vals()\n",
"\n",
"# Give the initial input tokens\n",
"seq.input([0,1,2,3,4])"
]
},
{
"cell_type": "markdown",
"id": "9dc23f88",
"metadata": {
"id": "9dc23f88"
},
"source": [
"The main operation you can use is \"attention\". You do this by defining a selector which forms a matrix based on `key` and `query`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e2ee0ff8",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 176
},
"id": "e2ee0ff8",
"outputId": "a61ac19c-2550-4f3c-d653-50c323cdfd59"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Selector Layer 0\n",
" 0 1 2 3 4\n",
" |h e l l o|\n",
" 0 1 2 3 4\n",
" |---------|\n",
"0 h 0 | 1 1 1 1\n",
"1 e 1 | 1 1 1\n",
"2 l 2 | 1 1\n",
"3 l 3 | 1\n",
"4 o 4 | "
],
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<svg baseProfile=\"full\" height=\"154.99999999999997\" version=\"1.1\" width=\"154\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><marker id=\"arrow\" markerHeight=\"3.5\" markerWidth=\"5\" orient=\"auto\" refX=\"5.0\" refY=\"1.7\"><polygon points=\"0,0 5,1.75 0,3.5\" /></marker></defs><g style=\"fill:white;\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 77.00000000000001, 77.00000000000001)\"><g transform=\"matrix(23.655913978494624, 0.0, 0.0, 23.655913978494624, 0.0, 0.0)\"><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5000000000000002, 0.5)\"><g><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -4.0, -1.9999999999999998)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -3.0999999999999996)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -2.0, -0.5)\"><g><g /><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -3.1, -0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -2.0)\"><g><g /><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 2.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 3.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 4.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g></g><g /></g></g></g></g></svg>"
},
"metadata": {},
"execution_count": 4
}
],
"source": [
"before = key(indices) < query(indices)\n",
"before"
]
},
{
"cell_type": "markdown",
"id": "a4de0a14",
"metadata": {
"id": "a4de0a14"
},
"source": [
"We can combine selectors with logical operations."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c315ba6d",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 201
},
"id": "c315ba6d",
"outputId": "270d50fa-649c-438b-8606-d3d078478162"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"Selector Layer 0\n",
" 0 1 2 3 4\n",
" |h e l l o|\n",
" 0 1 2 3 4\n",
" 0 1 2 3 4\n",
" |---------|\n",
"0 h 0 | 1 1 1 1 1\n",
"1 e 1 | 1 1 1 1\n",
"2 l 2 | 1 1 1\n",
"3 l 3 | 1 1\n",
"4 o 4 | 1"
],
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<svg baseProfile=\"full\" height=\"179.99999999999997\" version=\"1.1\" width=\"180\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><marker id=\"arrow\" markerHeight=\"3.5\" markerWidth=\"5\" orient=\"auto\" refX=\"5.0\" refY=\"1.7\"><polygon points=\"0,0 5,1.75 0,3.5\" /></marker></defs><g style=\"fill:white;\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 89.99999999999999, 89.99999999999999)\"><g transform=\"matrix(23.809523809523807, 0.0, 0.0, 23.809523809523807, 0.0, 0.0)\"><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 1.0)\"><g><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -4.0, -1.9999999999999998)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -3.5999999999999996)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -2.0, -1.0)\"><g><g><g /><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -3.6, -0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -1.0, -2.0)\"><g><g><g /><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 2.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 3.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 4.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 2.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 3.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 4.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g></g><g /></g></g></g></g></svg>"
},
"metadata": {},
"execution_count": 5
}
],
"source": [
"before_or_same = before | (key(indices) == query(indices))\n",
"before_or_same"
]
},
{
"cell_type": "markdown",
"id": "00bc66a3",
"metadata": {
"id": "00bc66a3"
},
"source": [
"Once you have a selector, you can apply \"attention\" to sum over the grey positions. For example to compute cumulative such we run the following function. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e79c8c8b",
"metadata": {
"lines_to_next_cell": 1,
"colab": {
"base_uri": "https://localhost:8080/",
"height": 326
},
"id": "e79c8c8b",
"outputId": "44db7f90-502d-497c-c5ba-4062c09f0a9a"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[0, 1, 3, 6, 10]"
],
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<svg baseProfile=\"full\" height=\"305.0\" version=\"1.1\" width=\"305\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><marker id=\"arrow\" markerHeight=\"3.5\" markerWidth=\"5\" orient=\"auto\" refX=\"5.0\" refY=\"1.7\"><polygon points=\"0,0 5,1.75 0,3.5\" /></marker></defs><g style=\"fill:white;\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 152.5, 152.5)\"><g transform=\"matrix(23.80952380952381, 0.0, 0.0, 23.80952380952381, 0.0, 0.0)\"><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -4.6, -5.6)\"><g><g><g><g><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Input</text></g><g /></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.0)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 6.1)\"><g><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Layer 1</text></g><g /></g><g /></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 7.1, 0.0)\"><g><g><g><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -4.0, -1.9999999999999998)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g><g><g><g><g><g><g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, -0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 0.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 1.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #ffffff;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 2.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g style=\"fill: #d3d3d3;stroke: #071e22;stroke-width: 0.9;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.5, 3.5)\"><path d=\"M 0.0 0.0 L 1.0 0.0 L 1.0 1.0 L 0.0 1.0 L 0.0 0.0 Z\" style=\"vector-effect: non-scaling-stroke;\" /></g></g></g></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -3.5999999999999996)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -2.0, -1.0)\"><g><g><g /><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #f4c095;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -3.6, -0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -1.0, -2.0)\"><g><g><g /><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 2.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 3.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 4.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 2.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 3.5)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 4.0)\"><g><g style=\"fill: #679289;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0999999999999996, 0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -2.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #071e22;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.0)\"><g><g style=\"fill: #071e22;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 1.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g style=\"fill: #071e22;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0)\"><g><g style=\"fill: #071e22;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">6</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.5)\"><g transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 4.0)\"><g><g style=\"fill: #071e22;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">10</text></g><g /></g></g></g></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 3.0999999999999996)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -2.0, -0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #ee2e31;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #ee2e31;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #ee2e31;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #ee2e31;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #ee2e31;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">4</text></g><g /></g></g></g></g></g></g></g></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 10.2)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 11.2)\"><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Final</text></g><g /></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">0</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">6</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 4.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">10</text></g><g /></g></g></g></g></g></g></g></g></g><g /></g></g></g></g></svg>"
},
"metadata": {},
"execution_count": 6
}
],
"source": [
"def cumsum(seq=tokens):\n",
" return before_or_same.value(seq)\n",
"seq = cumsum()\n",
"seq.input([0, 1, 2, 3, 4])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9ae57559",
"metadata": {
"cellView": "form",
"id": "9ae57559"
},
"outputs": [],
"source": [
"#@title Test Code (Collapse)\n",
"def atoi(seq=tokens):\n",
" return seq.map(lambda x: ord(x) - ord('0'))\n",
"\n",
"def test_output(user, spec, token_sets):\n",
" for ex_num, token_set in enumerate(token_sets): \n",
" out1 = user(*token_set[:-1])((token_set[-1]))\n",
" out2 = spec(*token_set)\n",
" print(f\"Example {ex_num}. Args:\", token_set, \"Expected:\", out2)\n",
" display(out1)\n",
" out1 = out1.toseq()\n",
" for i, o in enumerate(out2):\n",
" assert out1[i] == o, f\"Output: {out1} Expected: {out2}\"\n",
"\n",
" pups = [\n",
" \"2m78jPG\",\n",
" \"pn1e9TO\",\n",
" \"MQCIwzT\",\n",
" \"udLK6FS\",\n",
" \"ZNem5o3\",\n",
" \"DS2IZ6K\",\n",
" \"aydRUz8\",\n",
" \"MVUdQYK\",\n",
" \"kLvno0p\",\n",
" \"wScLiVz\",\n",
" \"Z0TII8i\",\n",
" \"F1SChho\",\n",
" \"9hRi2jN\",\n",
" \"lvzRF3W\",\n",
" \"fqHxOGI\",\n",
" \"1xeUYme\",\n",
" \"6tVqKyM\",\n",
" \"CCxZ6Wr\",\n",
" \"lMW0OPQ\",\n",
" \"wHVpHVG\",\n",
" \"Wj2PGRl\",\n",
" \"HlaTE8H\",\n",
" \"k5jALH0\",\n",
" \"3V37Hqr\",\n",
" \"Eq2uMTA\",\n",
" \"Vy9JShx\",\n",
" \"g9I2ZmK\",\n",
" \"Nu4RH7f\",\n",
" \"sWp0Dqd\",\n",
" \"bRKfspn\",\n",
" \"qawCMl5\",\n",
" \"2F6j2B4\",\n",
" \"fiJxCVA\",\n",
" \"pCAIlxD\",\n",
" \"zJx2skh\",\n",
" \"2Gdl1u7\",\n",
" \"aJJAY4c\",\n",
" \"ros6RLC\",\n",
" \"DKLBJh7\",\n",
" \"eyxH0Wc\",\n",
" \"rJEkEw4\"]\n",
" print(\"Success!\")\n",
" return HTML(\"\"\"\n",
" <video alt=\"test\" controls autoplay=1>\n",
" <source src=\"https://openpuppies.com/mp4/%s.mp4\" type=\"video/mp4\">\n",
" </video>\n",
" \"\"\"%(random.sample(pups, 1)[0]))\n",
"SEQ = [2,1,3,2,4]\n",
"SEQ2 = [3, 4 ,3, -1, 2]"
]
},
{
"cell_type": "markdown",
"id": "57d753ac",
"metadata": {
"id": "57d753ac"
},
"source": [
"For each problem we will provide a Python specification. Your goal is to implement that specification with Transformers."
]
},
{
"cell_type": "markdown",
"id": "77441886",
"metadata": {
"id": "77441886"
},
"source": [
"### Challenge 0: Select the initial position\n",
"\n",
"Given a initial sequence compute a new sequence where all positions have the initial value. (1 line)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1da74d03",
"metadata": {
"id": "1da74d03"
},
"outputs": [],
"source": [
"def head_spec(seq):\n",
" return [seq[0] for _ in seq]\n",
"\n",
"def head(seq=tokens):\n",
" return (key(indices) == query(0)).value(seq)\n",
" \n",
"test_output(head, head_spec, [(SEQ,),(SEQ2,)])"
]
},
{
"cell_type": "markdown",
"id": "f565d61c",
"metadata": {
"id": "f565d61c"
},
"source": [
"### Challenge 1: Select a given index\n",
"\n",
"Produce a sequence where all the elements have the value at index `i`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10d1b909",
"metadata": {
"lines_to_next_cell": 1,
"id": "10d1b909"
},
"outputs": [],
"source": [
"def index_spec(i, seq):\n",
" return [seq[i] for _ in seq]\n",
"\n",
"def index(i, seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(index, index_spec, [(2, SEQ), (3, SEQ2), (1, SEQ)])"
]
},
{
"cell_type": "markdown",
"id": "a6c2b47d",
"metadata": {
"id": "a6c2b47d"
},
"source": [
"### Challenge 2: Shift\n",
"\n",
"Shift all of the tokens in a sequence to the right by `i` positions filling in the values with `default`. (1 line)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d9b5db79",
"metadata": {
"lines_to_next_cell": 1,
"id": "d9b5db79"
},
"outputs": [],
"source": [
"def shift_spec(i, default=\"0\", seq=None):\n",
" return [default]*i + [s for j, s in enumerate(seq) if j < len(seq) - i]\n",
"\n",
"def shift(i, default=\"0\", seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(shift, shift_spec, [(2, 0, SEQ), (3, 0, SEQ2), (1, 0, SEQ)])"
]
},
{
"cell_type": "markdown",
"id": "3f87e538",
"metadata": {
"lines_to_next_cell": 2,
"id": "3f87e538"
},
"source": [
"### Challenge 3: Right Align\n",
"\n",
"Right align a padded sequence e.g. ralign().inputs('xyz___') = '000xyz'\" (3 layers) (2 lines)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a841d6f4",
"metadata": {
"lines_to_next_cell": 1,
"id": "a841d6f4"
},
"outputs": [],
"source": [
"def ralign_spec(ldefault=\"0\", seq=tokens):\n",
" last = None\n",
" for i in range(len(seq)-1, -1, -1):\n",
" if seq[i] == \"_\":\n",
" last = i\n",
" else:\n",
" break\n",
" if last == None:\n",
" return seq\n",
" return [ldefault] * (len(seq) - last) + seq[:last]\n",
"\n",
"def ralign(ldefault=\"0\", seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(ralign, ralign_spec, [(\"-\", list(\"xyzabc__\"),), (\"0\", list(\"xyz___\"),)])"
]
},
{
"cell_type": "markdown",
"id": "a178203a",
"metadata": {
"id": "a178203a"
},
"source": [
"### Challenge 4: Split\n",
"\n",
"Split a sequence on a value. Get the first or second part. Right align. (5 lines)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e69995ed",
"metadata": {
"lines_to_next_cell": 1,
"id": "e69995ed"
},
"outputs": [],
"source": [
"def split_spec(v, get_first_part, seq):\n",
" out = []\n",
" mid = False\n",
" blank = \"0\" if not get_first_part else \"_\"\n",
" for j, s in enumerate(seq):\n",
" if s == v:\n",
" out.append(blank)\n",
" mid = True\n",
" elif (get_first_part and not mid) or (not get_first_part and mid):\n",
" out.append(s)\n",
" else:\n",
" out.append(blank)\n",
" return ralign_spec(\"0\", seq=out)\n",
"\n",
"def split(v, get_first_part, seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(split, split_spec,\n",
" [(\"-\", 1, list(\"xyz-ax\"),),\n",
" (\"-\", 0, list(\"xyz-ax\"),),\n",
" (\"+\", 0, list(\"xy+z-ax\"),)]\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "f9d19ecd",
"metadata": {
"id": "f9d19ecd"
},
"source": [
"### Challenge 5: Minimum \n",
"\n",
"Compute the minimum value of the sequence. This one starts to get harder! (5 lines of code)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53b19ac8",
"metadata": {
"lines_to_next_cell": 1,
"id": "53b19ac8"
},
"outputs": [],
"source": [
"def minimum_spec(seq):\n",
" m = min(seq)\n",
" return [m for _ in seq]\n",
"\n",
"def minimum(seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(minimum, minimum_spec, [(SEQ,), (SEQ2,), ([2, 1, 1],)])"
]
},
{
"cell_type": "markdown",
"id": "6d2fe8ec",
"metadata": {
"id": "6d2fe8ec"
},
"source": [
"### Challenge 6: First Index\n",
"\n",
"Compute the first index that has token `token`. (1 line)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a4a6a030",
"metadata": {
"lines_to_next_cell": 1,
"id": "a4a6a030"
},
"outputs": [],
"source": [
"def first_spec(token, seq):\n",
" first = None\n",
" for i, s in enumerate(seq):\n",
" if s == token and first is None:\n",
" first = i\n",
" return [first for _ in seq]\n",
"\n",
"def first(token, seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(first, first_spec, [(3, SEQ), (-1, SEQ2), ('l', list('hello'))])"
]
},
{
"cell_type": "markdown",
"id": "38236f00",
"metadata": {
"id": "38236f00"
},
"source": [
"### Challenge 7: Slide\n",
"\n",
"Replace special tokens \"<\" with the closest non \"<\" value to their right. (4 lines of code)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7781c97c",
"metadata": {
"id": "7781c97c"
},
"outputs": [],
"source": [
"def slide_spec(match, seq):\n",
" out = []\n",
" for i, s in enumerate(seq):\n",
" if s == \"<\":\n",
" for v in seq[i+1:]:\n",
" if v != \"<\":\n",
" out.append(v)\n",
" break\n",
" else:\n",
" out.append(s)\n",
" return out\n",
"\n",
"def slide(match=\"<\", seq=tokens):\n",
" raise NotImplementedError\n",
"\n",
"test_output(slide, slide_spec,\n",
" [(\"<\", list(\"1<<2\"),),\n",
" (\"<\", list(\"2<<<3\"),),\n",
" (\"<\", list(\"3<<<1<<3\"),)]\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "6be44511",
"metadata": {
"id": "6be44511"
},
"source": [
"### Final Challenge: Adder\n",
"\n",
"Now we will put everything together. Here are the steps. \n",
"\n",
"add().input(\"683+345\")\n",
"\n",
"0) Split into parts. Convert to ints. Add\n",
"\n",
"> \"683+345\" => [0, 0, 0, 9, 12, 8]\n",
"\n",
"1) Compute the carry terms. Three possibilities: 1 has carry, 0 no carry, < maybe has carry. \n",
"\n",
"> [0, 0, 0, 9, 12, 8] => \"00<100\"\n",
"\n",
"2) Slide the carry coefficients\n",
"\n",
"> \"00<100\" => 001100\"\n",
"\n",
"3) Complete the addition.\n",
"\n",
"Each of these is 1 line of code. "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11b27d5b",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 96
},
"id": "11b27d5b",
"outputId": "b1224ef6-c889-40ab-f051-fd00e37ceb2a"
},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[1, 3, 2, 1]"
],
"image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<svg baseProfile=\"full\" height=\"75.0\" version=\"1.1\" width=\"175\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><marker id=\"arrow\" markerHeight=\"3.5\" markerWidth=\"5\" orient=\"auto\" refX=\"5.0\" refY=\"1.7\"><polygon points=\"0,0 5,1.75 0,3.5\" /></marker></defs><g style=\"fill:white;\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 87.5, 37.5)\"><g transform=\"matrix(23.809523809523807, 0.0, 0.0, 23.809523809523807, 0.0, 0.0)\"><g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -0.0, -0.0)\"><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, -2.0, -1.0)\"><g><g><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Input</text></g><g /></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g></g></g><g style=\"stroke: black;stroke-width: 0.9;\" transform=\"matrix(0.0, -1.0, 1.0, 0.0, 0.0, 1.0)\"><g /></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 2.0)\"><g><g><g><g style=\"fill: #1d7874;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">Final</text></g><g /></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g><g><g><g><g><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">3</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 1.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">2</text></g><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 2.5, 0.0)\"><g transform=\"matrix(1.0, -0.0, 0.0, 1.0, 0.0, 0.0)\"><g /></g></g></g><g transform=\"matrix(1.0, 0.0, 0.0, 1.0, 3.0, 0.0)\"><g><g style=\"fill: #000000;stroke: black;stroke-width: 0.0;\" transform=\"matrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0)\"><text style=\"text-align:center; text-anchor:middle; dominant-baseline:middle; font-family:sans-serif; font-weight: bold; font-size:0.85px; vector-effect: non-scaling-stroke;\" transform=\"translate(-5e-05, 0)\">1</text></g><g /></g></g></g></g></g></g></g></g></g><g /></g></g></g></g></svg>"
},
"metadata": {},
"execution_count": 32
}
],
"source": [
"# The function atoi lets us convert from string to sequences of integers\n",
"atoi(tokens).input(\"1321\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3370d2c8",
"metadata": {
"id": "3370d2c8"
},
"outputs": [],
"source": [
"def add_spec(seq):\n",
" a, b = \"\".join(seq).split(\"+\")\n",
" c = int(a) + int(b)\n",
" out = f\"{c}\"\n",
" return list(map(int, list((\"0\" * (len(seq) - len(out))) + out)))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "98a331c6",
"metadata": {
"id": "98a331c6"
},
"outputs": [],
"source": [
"def add(seq=tokens):\n",
" x = atoi(split(\"+\", True, seq)) \\\n",
" + atoi(split(\"+\", False, seq))\n",
" # 1) Check for carries \n",
" gets_carry = shift(-1, \"0\", where(x > 9, \"1\", where(x == 9, \"<\", \"0\")))\n",
" # 2) Slide carries to their columns - all in one parallel go! \n",
" gets_carry = atoi(slide(\"<\", gets_carry))\n",
" # 3) Add in carries, and remove overflow from original addition. \n",
" return (x + gets_carry) % 10"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f1f708c",
"metadata": {
"id": "7f1f708c"
},
"outputs": [],
"source": [
"test_output(add, add_spec,\n",
" [(list(\"1+2\"),),\n",
" (list(\"22+384\"),),\n",
" (list(\"3+10\"),)]\n",
" )"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "raspy",
"language": "python",
"name": "raspy"
},
"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.10.6"
},
"colab": {
"provenance": [],
"include_colab_link": true
}
},
"nbformat": 4,
"nbformat_minor": 5
}
gitextract_c6so92vp/ ├── .gitignore ├── LICENSE ├── README.md └── TransformerPuzzlers.ipynb
Condensed preview — 4 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (127K chars).
[
{
"path": ".gitignore",
"chars": 3078,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
},
{
"path": "LICENSE",
"chars": 1067,
"preview": "MIT License\n\nCopyright (c) 2023 Sasha Rush\n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
},
{
"path": "README.md",
"chars": 3142,
"preview": "# Transformer Puzzles\n\n<a target=\"_blank\" href=\"https://colab.research.google.com/github/srush/Transformer-Puzzles/blob/"
},
{
"path": "TransformerPuzzlers.ipynb",
"chars": 111096,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"view-in-github\",\n \"colab_t"
}
]
About this extraction
This page contains the full source code of the srush/Transformer-Puzzles GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 4 files (115.6 KB), approximately 49.5k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.