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.6.tar.gz
(7.4 kB
view hashes)
Built Distribution
tfsurgeon-0.0.6-py3-none-any.whl
(12.8 kB
view hashes)
Close
Hashes for tfsurgeon-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e70e6115840a7d467d4244430cddba884334674f63d59ae40b8668abe11a1f81 |
|
MD5 | 1cf43228ac1567bdc4a9d9932e5d5651 |
|
BLAKE2b-256 | 9a07a2b3707a90287c9c6479bf1f1d0156d4752a21ec07848f76c5b92ded059d |