Edits tensorflow model layers
Project description
TFSurgeon
Allows for dynamic tensorflow keras model edition.
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 .src.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.1.tar.gz
(7.4 kB
view hashes)
Built Distribution
tfsurgeon-0.0.1-py3-none-any.whl
(12.6 kB
view hashes)
Close
Hashes for tfsurgeon-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27a3b96eb18e77ef14e8d03200d434ba1df8ff320a34d006152fe573d2f65076 |
|
MD5 | 1734b1da23ab3cf01f08688cac11b784 |
|
BLAKE2b-256 | 2e0d3313c83ce902ee2d96d277c1d20c7e139759be515e364d857c7029caca53 |