Edits tensorflow model layers
Project description
TFSurgeon
Allows for dynamic tensorflow keras model edition.
You can install this package with pip and call it as from tfsurgeon import edit_model
.
How to use
- remove layers based on layer type
- remove layers based on name or index
- replace layers from one type to another
- replace specific layer (name) by another layer (callable)
see docstring for examples in src/tfsurgeon/tfsurgeon.py
.
import
from tfsurgeon import edit_model
import tensorflow as tf
model = tf.keras.applications.MobileNetV2(weights=None)
new_model = edit_model(
model=model,
replace_layers_by_types=[
[tf.keras.layers.BatchNormalization, tf.keras.layers.LayerNormalization]
],
verbose=True,
)
CLI
no supported yet
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
tfsurgeon-0.0.8.tar.gz
(7.6 kB
view details)
Built Distribution
tfsurgeon-0.0.8-py3-none-any.whl
(12.8 kB
view details)
File details
Details for the file tfsurgeon-0.0.8.tar.gz
.
File metadata
- Download URL: tfsurgeon-0.0.8.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82548684f9f5b36028bf846ccc944a1615e8076f4ffdfc714baf6939990beace |
|
MD5 | ba2ecd3dd17ce03b3e0c0a2095c70e1b |
|
BLAKE2b-256 | 3a5faa466b7cdea768266a513c73709bc5912ff49f6ad42755d982ffeb575f01 |
File details
Details for the file tfsurgeon-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: tfsurgeon-0.0.8-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dacaebbcd399bf9792e7463818df2e820a3ec3cc32a71f04489db9ae02b8ab6 |
|
MD5 | 2b75f13485081dd164d384b8e0451475 |
|
BLAKE2b-256 | 7064d23a0484829de1f3b87e08c82644112f3e7845eee72b56acb8381219f27d |