Skip to content

Commit

Permalink
pylance typing
Browse files Browse the repository at this point in the history
  • Loading branch information
calad0i committed Jan 6, 2024
1 parent 40aa34d commit 5f8679e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/HGQ/proxy/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,14 @@ def apply_layer(
- if the layer is a model, apply the model recursively in a flattened manner.
- if the layer is a keras layer, transform it by layer_transformer, until the exactly same reference is returned.
"""
if layer is None:
return inp_tensors[0] if len(inp_tensors) == 1 else inp_tensors

layer_xf = layer_xformer(layer)
n = 0
while layer_xf is not layer:
if isinstance(layer_xf, keras.Model):
# layer_transformer may return a keras.Model from a layer.
return apply_layer(layer_xf, inp_tensors, namer=namer, layer_xformer=layer_xformer)
assert n < 1024, f'layer_transformer does not converge for layer {layer.name}.'
assert n < 1024, f'layer_transformer does not converge for layer (name: {layer.name if layer is not None else None}).'
layer = layer_xf
layer_xf = layer_xformer(layer)
n += 1
Expand Down

0 comments on commit 5f8679e

Please sign in to comment.