A TensorFlow 2 implementation of LambdaNetworks.
Project description
Lambda Networks
This is a TensorFlow 2 implementation of a Lambda Layer from: LambdaNetworks: Modeling Long-Range Interactions Without Attention. LambdaNetworks achieve SOTA on ImageNet. For now, this library provides a basic UNTESTED version of the Lambda Layer based off of this repository.
Usage
Global Context
import tensorflow as tf
layer = LambdaLayer(
dim_out = 32, # channels out
n = 64 * 64, # number of input pixels (64 x 64 image)
dim_k = 16, # key dimension
heads = 4, # number of heads, for multi-query
dim_u = 1 # 'intra-depth' dimension
)
x = tf.random.normal(shape=(1, 64, 64, 32))
layer(x)
Local Context
layer = LambdaLayer(
dim_out = 32,
r = 23, # the receptive field for relative positional encoding (23 x 23)
dim_k = 16,
heads = 4,
dim_u = 4
)
x = tf.random.normal(shape=(1, 64, 64, 32))
layer(x)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tf-lambda-0.2.0.tar.gz.
File metadata
- Download URL: tf-lambda-0.2.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb5b14eec9653c8b972c5325698f1cac1b38fc6e945c690305f53ccbeec872d2
|
|
| MD5 |
8331aa7f1e3dafc2ae02692d3109487f
|
|
| BLAKE2b-256 |
c626cdf1f8c55824f4d747783dca1abbf7947d767ba7229379de15f7e627e4e6
|
File details
Details for the file tf_lambda-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tf_lambda-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf4a74da9118c09ebf28dcc832ebc5eeeb095ef0b8c7375d73dd5e38e3038802
|
|
| MD5 |
66ee83e75b5e89a1ac1ff1bac326be68
|
|
| BLAKE2b-256 |
045f81602f39813a0f246a281e00ab55d28f08be83a588cc312397a71067df84
|