mirror of
https://github.com/helblazer811/ManimML.git
synced 2025-05-31 06:08:06 +08:00
Added support for Neural Network overhead title and per-layer title.
This commit is contained in:
@ -65,7 +65,7 @@ class EmbeddingLayer(VGroupNeuralNetworkLayer):
|
||||
return animation_group
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_embedding_layer(self, **kwargs):
|
||||
def _create_override(self, **kwargs):
|
||||
# Plot each point at once
|
||||
point_animations = []
|
||||
for point in self.point_cloud:
|
||||
|
@ -44,6 +44,6 @@ class EmbeddingToFeedForward(ConnectiveLayer):
|
||||
return animation_group
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_embedding_layer(self, **kwargs):
|
||||
def _create_override(self, **kwargs):
|
||||
return AnimationGroup()
|
||||
|
@ -55,7 +55,7 @@ class FeedForwardLayer(VGroupNeuralNetworkLayer):
|
||||
return succession
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_animation(self, **kwargs):
|
||||
def _create_override(self, **kwargs):
|
||||
animations = []
|
||||
|
||||
animations.append(Create(self.surrounding_rectangle))
|
||||
|
@ -48,6 +48,6 @@ class FeedForwardToEmbedding(ConnectiveLayer):
|
||||
return animation_group
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_embedding_layer(self, **kwargs):
|
||||
def _create_override(self, **kwargs):
|
||||
return AnimationGroup()
|
||||
|
||||
|
@ -57,7 +57,7 @@ class FeedForwardToFeedForward(ConnectiveLayer):
|
||||
return path_animations
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_animation(self, **kwargs):
|
||||
def _create_override(self, **kwargs):
|
||||
animations = []
|
||||
|
||||
for edge in self.edges:
|
||||
|
@ -17,7 +17,7 @@ class ImageLayer(NeuralNetworkLayer):
|
||||
self.add(self.image_mobject)
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_animation(self, **kwargs):
|
||||
def _create_override(self, **kwargs):
|
||||
return FadeIn(self.image_mobject)
|
||||
|
||||
def make_forward_pass_animation(self):
|
||||
|
@ -56,7 +56,7 @@ class PairedQueryLayer(NeuralNetworkLayer):
|
||||
return assets
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_layer(self):
|
||||
def _create_override(self):
|
||||
# TODO make Create animation that is custom
|
||||
return FadeIn(self.assets)
|
||||
|
||||
|
@ -6,11 +6,17 @@ class NeuralNetworkLayer(ABC, Group):
|
||||
|
||||
def __init__(self, text=None, **kwargs):
|
||||
super(Group, self).__init__()
|
||||
self.title_text = kwargs["title"] if "title" in kwargs else " "
|
||||
self.title = Text(self.title_text, font_size=DEFAULT_FONT_SIZE/3)
|
||||
|
||||
@abstractmethod
|
||||
def make_forward_pass_animation(self):
|
||||
pass
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_override(self):
|
||||
pass
|
||||
|
||||
def __repr__(self):
|
||||
return f"{type(self).__name__}"
|
||||
|
||||
@ -23,6 +29,10 @@ class VGroupNeuralNetworkLayer(NeuralNetworkLayer):
|
||||
def make_forward_pass_animation(self):
|
||||
pass
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_override(self):
|
||||
return super()._create_override()
|
||||
|
||||
class ConnectiveLayer(VGroupNeuralNetworkLayer):
|
||||
"""Forward pass animation for a given pair of layers"""
|
||||
|
||||
@ -40,4 +50,8 @@ class ConnectiveLayer(VGroupNeuralNetworkLayer):
|
||||
|
||||
@abstractmethod
|
||||
def make_forward_pass_animation(self):
|
||||
pass
|
||||
pass
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_override(self):
|
||||
return super()._create_override()
|
@ -67,7 +67,7 @@ class TripletLayer(NeuralNetworkLayer):
|
||||
return assets
|
||||
|
||||
@override_animation(Create)
|
||||
def _create_layer(self):
|
||||
def _create_override(self):
|
||||
# TODO make Create animation that is custom
|
||||
return FadeIn(self.assets)
|
||||
|
||||
|
Reference in New Issue
Block a user