mirror of
https://github.com/helblazer811/ManimML.git
synced 2025-06-28 01:45:53 +08:00
Added a basic neural network example
This commit is contained in:
22
examples/basic_neural_network.py
Normal file
22
examples/basic_neural_network.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from manim import *
|
||||||
|
from manim_ml.neural_network.layers import FeedForwardLayer
|
||||||
|
from manim_ml.neural_network.neural_network import NeuralNetwork
|
||||||
|
|
||||||
|
class NeuralNetworkScene(Scene):
|
||||||
|
"""Test Scene for the Neural Network"""
|
||||||
|
|
||||||
|
def construct(self):
|
||||||
|
# Make the Layer object
|
||||||
|
layers = [
|
||||||
|
FeedForwardLayer(3),
|
||||||
|
FeedForwardLayer(5),
|
||||||
|
FeedForwardLayer(3)
|
||||||
|
]
|
||||||
|
nn = NeuralNetwork(layers)
|
||||||
|
nn.move_to(ORIGIN)
|
||||||
|
# Make Animation
|
||||||
|
self.add(nn)
|
||||||
|
#self.play(Create(nn))
|
||||||
|
forward_propagation_animation = nn.make_forward_pass_animation(run_time=5, passing_flash=True)
|
||||||
|
|
||||||
|
self.play(forward_propagation_animation)
|
Reference in New Issue
Block a user