helblazer811 / ManimML

ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.
MIT License
2.35k stars 140 forks source link

AttributeError: MaxPooling2DLayer object has no attribute 'padding' #28

Closed eliasdjup closed 1 year ago

eliasdjup commented 1 year ago

The code from the example of MaxPooling2DLayer returns AttributeError. Same for /examples/cnn/cnn_max_pool.py

Using manim==0.17.2 and manim-ml==0.0.16.

from manim import *

from manim_ml.neural_network import NeuralNetwork, Convolutional2DLayer, MaxPooling2DLayer

class BasicScene(ThreeDScene):
    def construct(self):
        nn = NeuralNetwork(
            [
                Convolutional2DLayer(1, 8),
                Convolutional2DLayer(3, 6, 3),
                MaxPooling2DLayer(
                    kernel_size=2,
                ),
                Convolutional2DLayer(5, 2, 2),
            ],
            layer_spacing=0.25,
        )
        nn.move_to(ORIGIN)
        self.add(nn)
        forward_pass = nn.make_forward_pass_animation()
        self.wait(1)
        self.play(forward_pass)`

Stack trace:

convolutional_2d_to_convolutional_2d.py:309 in init │ │ │ │ 306 │ │ self.num_output_feature_maps = self.output_layer.num_feature_maps │ │ 307 │ │ self.cell_width = self.output_layer.cell_width │ │ 308 │ │ self.stride = self.output_layer.stride │ │ ❱ 309 │ │ self.padding = self.input_layer.padding │ │ 310 │ │ self.filter_opacity = filter_opacity │ │ 311 │ │ self.cell_width = cell_width │ │ 312 │ │ self.line_color = line_color

mobject.py:660 │ │ in getattr │ │ │ │ 657 │ │ │ return types.MethodType(setter, self) │ │ 658 │ │ │ │ 659 │ │ # Unhandled attribute, therefore error │ │ ❱ 660 │ │ raise AttributeError(f"{type(self).name} object has no attribute '{attr} │ │ 661 │ │ │ 662 │ @property │ │ 663 │ def width(self):

AttributeError: MaxPooling2DLayer object has no attribute 'padding'

helblazer811 commented 1 year ago

Sorry about that. It should be fixed if you run pip install --upgrade manim_ml.

eliasdjup commented 1 year ago

Thank you for the quick response and help!