Skip to main content

Kattention

This package implements different Attention mechanisms as Keras layers.

Setup

pip install kattention

Usage

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Flatten, Dense, Softmax
from kattention.layers import Transformer 

SEQUENCE_LENGTH = 4
EMBEDDING_SIZE = 300
CLASSES_TO_PREDICT = 5
ATT_HEADS = 2

model = Sequential()
model.add(Transformer(attention_heads=ATT_HEADS, input_shape=(SEQUENCE_LENGTH, EMBEDDING_SIZE)))
model.add(Transformer(attention_heads=ATT_HEADS))
model.add(Flatten())
model.add(Dense(CLASSES_TO_PREDICT))
model.add(Softmax())

print(model.summary())

Metadata

Release files for kattention 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kattention 0.1.2
File Size Uploaded Provenance Actions
kattention-0.1.2.tar.gz 2.5 kB Without provenance Details for kattention-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kattention 0.1.2
File Interpreter ABI Platform Actions
kattention-0.1.2-py3-none-any.whl Python 3 none any Details for kattention-0.1.2-py3-none-any.whl

Total release size: 7.6 kB

Release files / kattention-0.1.2.tar.gz

Download URL kattention-0.1.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8b0df6edb479d9b8dcadfb0812db20d51c2d92a74ce7044bc22ef7c974d46ee3
BLAKE2b-256 checksum
How to use checksums
235a117c5d49831f4ded115d2f8d00a6ca882e6576812a2b030b5a809f7e585c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

Release files / kattention-0.1.2-py3-none-any.whl

Download URL kattention-0.1.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa9af9b3fee639e0e7127c03978bdd8bd085d34cf85c3d0cffade3a1fa0954ed
BLAKE2b-256 checksum
How to use checksums
e8586520e35792db0c808a40e56c90c48ef806d9078ef249001506f1f46200d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

Security for kattention 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page