paulgavrikov / visualkeras

Visualkeras is a Python package to help visualize Keras (either standalone or included in TensorFlow) neural network architectures. It allows easy styling to fit most needs. This module supports layered style architecture generation which is great for CNNs (Convolutional Neural Networks), and a graph style architecture, which works great for most models including plain feed-forward networks.
MIT License
582 stars 67 forks source link

AttributeError: 'InputLayer' object has no attribute 'output_shape' #51

Closed YonatanRA closed 4 months ago

YonatanRA commented 7 months ago
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[20], line 1
----> 1 visualkeras.layered_view(model)

File /opt/anaconda3/envs/ia/lib/python3.9/site-packages/visualkeras/layered.py:85, in layered_view(model, to_file, min_z, min_xy, max_z, max_xy, scale_z, scale_xy, type_ignore, index_ignore, color_map, one_dim_orientation, background_fill, draw_volume, padding, spacing, draw_funnel, shade_step, legend, font, font_color)
     82 y = min_xy
     83 z = min_z
---> 85 if isinstance(layer.output_shape, tuple):
     86     shape = layer.output_shape
     87 elif isinstance(layer.output_shape, list) and len(
     88         layer.output_shape) == 1:  # drop dimension for non seq. models

AttributeError: 'InputLayer' object has no attribute 'output_shape'

Solution: Change output_shape by output.shape

jsosniakk commented 6 months ago

@YonatanRA Any updates on that one?

paulgavrikov commented 6 months ago

@YonatanRA Any updates on that one?

I merged a PR into main a few days ago. Should be fixed with a clean install from source

Sadegh-Kalami commented 6 months ago

thanks for the nice repo! Thank you for the great repository! However, we are still experiencing a bug identical to the one at the top. we have a bug exactly the same as top.

Soontosh commented 4 months ago

@Sadegh-Kalami Sorry for the late response, you'll need to install the latest version via GitHub. Use the following command:

pip install git+https://github.com/paulgavrikov/visualkeras

Marking as resolved