Skip to main content

Attention mechanism for processing sequence data that considers the context for each timestamp

Project description

Travis Coverage

Attention mechanism for processing sequence data that considers the context for each timestamp.

Install

pip install keras-self-attention

Usage

import keras
from keras_self_attention import Attention


model = keras.models.Sequential()
model.add(keras.layers.Embedding(input_dim=10000,
                                 output_dim=300,
                                 mask_zero=True))
model.add(keras.layers.Bidirectional(keras.layers.LSTM(units=128,
                                                       return_sequences=True)))
model.add(Attention())
model.add(keras.layers.Dense(units=5))
model.compile(
    optimizer='adam',
    loss='categorical_crossentropy',
    metrics=['categorical_accuracy'],
)
model.summary()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keras-self-attention-0.0.10.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file keras-self-attention-0.0.10.tar.gz.

File metadata

  • Download URL: keras-self-attention-0.0.10.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.4

File hashes

Hashes for keras-self-attention-0.0.10.tar.gz
Algorithm Hash digest
SHA256 b1e853a2fce372a7410d0f83150f8a4d80bd11bcdb8e4b32377fcb1a046fd1d4
MD5 251f5167df1c20296c461d0f6b6b8e02
BLAKE2b-256 6eae4b84b483fec410604414d138d39b770fa3d8d7249010eda670bfbc114c03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page