repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/directories.py | manimlib/utils/directories.py | from __future__ import annotations
import os
import tempfile
import appdirs
from manimlib.config import manim_config
from manimlib.config import get_manim_dir
from manimlib.utils.file_ops import guarantee_existence
def get_directories() -> dict[str, str]:
return manim_config.directories
def get_cache_dir() -... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/family_ops.py | manimlib/utils/family_ops.py | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Iterable, List, Set, Tuple
from manimlib.mobject.mobject import Mobject
def extract_mobject_family_members(
mobject_list: Iterable[Mobject],
exclude_pointless: bool = False
) -> list[Mobject]:
... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/space_ops.py | manimlib/utils/space_ops.py | from __future__ import annotations
from functools import reduce
import math
import operator as op
import platform
from mapbox_earcut import triangulate_float32 as earcut
import numpy as np
from scipy.spatial.transform import Rotation
from tqdm.auto import tqdm as ProgressDisplay
from manimlib.constants import DOWN, ... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/__init__.py | manimlib/utils/__init__.py | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false | |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/images.py | manimlib/utils/images.py | from __future__ import annotations
import numpy as np
from PIL import Image
from manimlib.utils.directories import get_raster_image_dir
from manimlib.utils.directories import get_vector_image_dir
from manimlib.utils.file_ops import find_file
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import ... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/shaders.py | manimlib/utils/shaders.py | from __future__ import annotations
import os
import re
from functools import lru_cache
import moderngl
from PIL import Image
import numpy as np
from manimlib.utils.directories import get_shader_dir
from manimlib.utils.file_ops import find_file
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing impor... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/color.py | manimlib/utils/color.py | from __future__ import annotations
from colour import Color
from colour import hex2rgb
from colour import rgb2hex
import numpy as np
import random
from matplotlib import pyplot
from manimlib.constants import COLORMAP_3B1B
from manimlib.constants import WHITE
from manimlib.utils.bezier import interpolate
from manimlib... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/cache.py | manimlib/utils/cache.py | from __future__ import annotations
import os
from diskcache import Cache
from contextlib import contextmanager
from functools import wraps
from manimlib.utils.directories import get_cache_dir
from manimlib.utils.simple_functions import hash_string
from typing import TYPE_CHECKING
if TYPE_CHECKING:
T = TypeVar('... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/tex_to_symbol_count.py | manimlib/utils/tex_to_symbol_count.py | TEX_TO_SYMBOL_COUNT = {
R"\!": 0,
R"\,": 0,
R"\-": 0,
R"\/": 0,
R"\:": 0,
R"\;": 0,
R"\>": 0,
R"\aa": 0,
R"\AA": 0,
R"\ae": 0,
R"\AE": 0,
R"\arccos": 6,
R"\arcsin": 6,
R"\arctan": 6,
R"\arg": 3,
R"\author": 0,
R"\bf": 0,
R"\bibliography": 0,
R"... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/bezier.py | manimlib/utils/bezier.py | from __future__ import annotations
import numpy as np
from scipy import linalg
from fontTools.cu2qu.cu2qu import curve_to_quadratic
from manimlib.logger import log
from manimlib.utils.simple_functions import choose
from manimlib.utils.space_ops import cross2d
from manimlib.utils.space_ops import cross
from manimlib.u... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/utils/sounds.py | manimlib/utils/sounds.py | from __future__ import annotations
import subprocess
import threading
import platform
from manimlib.utils.directories import get_sound_dir
from manimlib.utils.file_ops import find_file
def get_full_sound_file_path(sound_file_name: str) -> str:
return find_file(
sound_file_name,
directories=[get_... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/mobject.py | manimlib/mobject/mobject.py | from __future__ import annotations
import copy
from functools import wraps
import itertools as it
import os
import pickle
import random
import sys
import moderngl
import numbers
import numpy as np
from manimlib.constants import DEFAULT_MOBJECT_TO_EDGE_BUFF
from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BU... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | true |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/matrix.py | manimlib/mobject/matrix.py | from __future__ import annotations
import numpy as np
from manimlib.constants import DOWN, LEFT, RIGHT, ORIGIN
from manimlib.constants import DEG
from manimlib.mobject.numbers import DecimalNumber
from manimlib.mobject.svg.tex_mobject import Tex
from manimlib.mobject.types.vectorized_mobject import VGroup
from maniml... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/boolean_ops.py | manimlib/mobject/boolean_ops.py | from __future__ import annotations
import numpy as np
import pathops
from manimlib.mobject.types.vectorized_mobject import VMobject
# Boolean operations between 2D mobjects
# Borrowed from https://github.com/ManimCommunity/manim/
def _convert_vmobject_to_skia_path(vmobject: VMobject) -> pathops.Path:
path = pa... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/numbers.py | manimlib/mobject/numbers.py | from __future__ import annotations
from functools import lru_cache
import numpy as np
from manimlib.constants import DOWN, LEFT, RIGHT, UP
from manimlib.constants import DEFAULT_MOBJECT_COLOR
from manimlib.mobject.svg.tex_mobject import Tex
from manimlib.mobject.svg.text_mobject import Text
from manimlib.mobject.type... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/probability.py | manimlib/mobject/probability.py | from __future__ import annotations
import numpy as np
from manimlib.constants import BLUE, BLUE_E, GREEN_E, GREY_B, GREY_D, MAROON_B, YELLOW
from manimlib.constants import DOWN, LEFT, RIGHT, UP
from manimlib.constants import MED_LARGE_BUFF, MED_SMALL_BUFF, SMALL_BUFF
from manimlib.mobject.geometry import Line
from ma... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/coordinate_systems.py | manimlib/mobject/coordinate_systems.py | from __future__ import annotations
from abc import ABC, abstractmethod
import numbers
import numpy as np
import itertools as it
from manimlib.constants import BLACK, BLUE, BLUE_D, BLUE_E, GREEN, GREY_A, RED, DEFAULT_MOBJECT_COLOR
from manimlib.constants import DEG, PI
from manimlib.constants import DL, UL, DOWN, DR,... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/number_line.py | manimlib/mobject/number_line.py | from __future__ import annotations
import numpy as np
from manimlib.constants import DOWN, LEFT, RIGHT, UP
from manimlib.constants import DEFAULT_LIGHT_COLOR
from manimlib.constants import MED_SMALL_BUFF, SMALL_BUFF
from manimlib.constants import YELLOW, DEG
from manimlib.mobject.geometry import Line, ArrowTip
from m... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/shape_matchers.py | manimlib/mobject/shape_matchers.py | from __future__ import annotations
from colour import Color
from manimlib.config import manim_config
from manimlib.constants import BLACK, RED, YELLOW, DEFAULT_MOBJECT_COLOR
from manimlib.constants import DL, DOWN, DR, LEFT, RIGHT, UL, UR
from manimlib.constants import SMALL_BUFF
from manimlib.mobject.geometry import... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/three_dimensions.py | manimlib/mobject/three_dimensions.py | from __future__ import annotations
import math
import numpy as np
from manimlib.constants import BLUE, BLUE_D, BLUE_E, GREY_A, BLACK
from manimlib.constants import IN, ORIGIN, OUT, RIGHT
from manimlib.constants import PI, TAU
from manimlib.mobject.mobject import Mobject
from manimlib.mobject.types.surface import SGr... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/interactive.py | manimlib/mobject/interactive.py | from __future__ import annotations
import numpy as np
from pyglet.window import key as PygletWindowKeys
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
from manimlib.constants import DOWN, LEFT, ORIGIN, RIGHT, UP
from manimlib.constants import MED_LARGE_BUFF, MED_SMALL_BUFF, SMALL_BUFF
from manimlib.constant... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/__init__.py | manimlib/mobject/__init__.py | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false | |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/mobject_update_utils.py | manimlib/mobject/mobject_update_utils.py | from __future__ import annotations
import inspect
from manimlib.constants import DEG
from manimlib.constants import RIGHT
from manimlib.mobject.mobject import Mobject
from manimlib.utils.simple_functions import clip
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Callable
import numpy... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/value_tracker.py | manimlib/mobject/value_tracker.py | from __future__ import annotations
import numpy as np
from manimlib.mobject.mobject import Mobject
from manimlib.utils.iterables import listify
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from manimlib.typing import Self
class ValueTracker(Mobject):
"""
Not meant to be displayed. Instead the po... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/geometry.py | manimlib/mobject/geometry.py | from __future__ import annotations
import math
import numpy as np
from manimlib.constants import DL, DOWN, DR, LEFT, ORIGIN, OUT, RIGHT, UL, UP, UR
from manimlib.constants import RED, BLACK, DEFAULT_MOBJECT_COLOR, DEFAULT_LIGHT_COLOR
from manimlib.constants import MED_SMALL_BUFF, SMALL_BUFF
from manimlib.constants i... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | true |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/changing.py | manimlib/mobject/changing.py | from __future__ import annotations
import numpy as np
from manimlib.constants import BLUE_B, BLUE_D, BLUE_E, GREY_BROWN, DEFAULT_MOBJECT_COLOR
from manimlib.mobject.mobject import Mobject
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.mobject.types.vectorized_mobject import VMobject
from m... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/functions.py | manimlib/mobject/functions.py | from __future__ import annotations
from isosurfaces import plot_isoline
import numpy as np
from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS
from manimlib.constants import YELLOW
from manimlib.mobject.types.vectorized_mobject import VMobject
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ty... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/frame.py | manimlib/mobject/frame.py | from __future__ import annotations
from manimlib.constants import BLACK, GREY_E
from manimlib.constants import FRAME_HEIGHT
from manimlib.mobject.geometry import Rectangle
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from manimlib.typing import ManimColor
class ScreenRectangle(Rectangle):
def __init__... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/vector_field.py | manimlib/mobject/vector_field.py | from __future__ import annotations
import itertools as it
import numpy as np
from scipy.integrate import solve_ivp
from manimlib.constants import FRAME_HEIGHT, FRAME_WIDTH
from manimlib.constants import DEFAULT_MOBJECT_COLOR
from manimlib.animation.indication import VShowPassingFlash
from manimlib.mobject.types.vect... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/types/point_cloud_mobject.py | manimlib/mobject/types/point_cloud_mobject.py | from __future__ import annotations
import numpy as np
from manimlib.mobject.mobject import Mobject
from manimlib.utils.color import color_gradient
from manimlib.utils.color import color_to_rgba
from manimlib.utils.iterables import resize_with_interpolation
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/types/vectorized_mobject.py | manimlib/mobject/types/vectorized_mobject.py | from __future__ import annotations
from functools import wraps
import numpy as np
from manimlib.constants import GREY_A, GREY_C, GREY_E
from manimlib.constants import DEFAULT_VMOBJECT_FILL_COLOR, DEFAULT_VMOBJECT_STROKE_COLOR
from manimlib.constants import BLACK
from manimlib.constants import DEFAULT_STROKE_WIDTH
fr... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | true |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/types/image_mobject.py | manimlib/mobject/types/image_mobject.py | from __future__ import annotations
import numpy as np
import moderngl
from PIL import Image
from manimlib.constants import DL, DR, UL, UR
from manimlib.mobject.mobject import Mobject
from manimlib.utils.bezier import inverse_interpolate
from manimlib.utils.images import get_full_raster_image_path
from manimlib.utils.... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/types/__init__.py | manimlib/mobject/types/__init__.py | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false | |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/types/dot_cloud.py | manimlib/mobject/types/dot_cloud.py | from __future__ import annotations
import moderngl
import numpy as np
from manimlib.constants import GREY_C, YELLOW
from manimlib.constants import ORIGIN, NULL_POINTS
from manimlib.mobject.mobject import Mobject
from manimlib.mobject.types.point_cloud_mobject import PMobject
from manimlib.utils.iterables import resiz... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/types/surface.py | manimlib/mobject/types/surface.py | from __future__ import annotations
import moderngl
import numpy as np
from manimlib.constants import GREY
from manimlib.constants import OUT
from manimlib.mobject.mobject import Mobject
from manimlib.utils.bezier import integer_interpolate
from manimlib.utils.bezier import interpolate
from manimlib.utils.bezier impor... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/tex_mobject.py | manimlib/mobject/svg/tex_mobject.py | from __future__ import annotations
import re
from pathlib import Path
from manimlib.mobject.svg.string_mobject import StringMobject
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.utils.color import color_to_hex
from manimlib.ut... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/text_mobject.py | manimlib/mobject/svg/text_mobject.py | from __future__ import annotations
from contextlib import contextmanager
import os
from pathlib import Path
import re
import tempfile
from functools import lru_cache
import manimpango
import pygments
import pygments.formatters
import pygments.lexers
from manimlib.config import manim_config
from manimlib.constants im... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/special_tex.py | manimlib/mobject/svg/special_tex.py | from __future__ import annotations
from manimlib.constants import MED_SMALL_BUFF, DEFAULT_MOBJECT_COLOR, GREY_C
from manimlib.constants import DOWN, LEFT, RIGHT, UP
from manimlib.constants import FRAME_WIDTH
from manimlib.constants import MED_LARGE_BUFF, SMALL_BUFF
from manimlib.mobject.geometry import Line
from manim... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/drawings.py | manimlib/mobject/svg/drawings.py | from __future__ import annotations
import numpy as np
import itertools as it
import random
from manimlib.animation.composition import AnimationGroup
from manimlib.animation.rotation import Rotating
from manimlib.constants import BLACK
from manimlib.constants import BLUE_A
from manimlib.constants import BLUE_B
from ma... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/svg_mobject.py | manimlib/mobject/svg/svg_mobject.py | from __future__ import annotations
from xml.etree import ElementTree as ET
import numpy as np
import svgelements as se
import io
from pathlib import Path
from manimlib.constants import RIGHT
from manimlib.constants import TAU
from manimlib.logger import log
from manimlib.mobject.geometry import Circle
from manimlib.... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/old_tex_mobject.py | manimlib/mobject/svg/old_tex_mobject.py | from __future__ import annotations
from functools import reduce
import operator as op
import re
from manimlib.constants import BLACK, DEFAULT_MOBJECT_COLOR
from manimlib.mobject.svg.svg_mobject import SVGMobject
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.utils.tex_file_writing import l... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/__init__.py | manimlib/mobject/svg/__init__.py | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false | |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/string_mobject.py | manimlib/mobject/svg/string_mobject.py | from __future__ import annotations
from abc import ABC, abstractmethod
import itertools as it
import re
from scipy.optimize import linear_sum_assignment
from scipy.spatial.distance import cdist
from manimlib.constants import DEFAULT_MOBJECT_COLOR
from manimlib.logger import log
from manimlib.mobject.svg.svg_mobject i... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/mobject/svg/brace.py | manimlib/mobject/svg/brace.py | from __future__ import annotations
import math
import copy
import numpy as np
from manimlib.constants import DEFAULT_MOBJECT_TO_MOBJECT_BUFF, SMALL_BUFF
from manimlib.constants import DOWN, LEFT, ORIGIN, RIGHT, DL, DR, UL, UP
from manimlib.constants import PI
from manimlib.animation.composition import AnimationGroup... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/indication.py | manimlib/animation/indication.py | from __future__ import annotations
import numpy as np
from manimlib.animation.animation import Animation
from manimlib.animation.composition import AnimationGroup
from manimlib.animation.composition import Succession
from manimlib.animation.creation import ShowCreation
from manimlib.animation.creation import ShowPart... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/rotation.py | manimlib/animation/rotation.py | from __future__ import annotations
from manimlib.animation.animation import Animation
from manimlib.constants import ORIGIN, OUT
from manimlib.constants import PI, TAU
from manimlib.utils.rate_functions import linear
from manimlib.utils.rate_functions import smooth
from typing import TYPE_CHECKING
if TYPE_CHECKING:
... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/transform.py | manimlib/animation/transform.py | from __future__ import annotations
import inspect
import numpy as np
from manimlib.animation.animation import Animation
from manimlib.constants import DEG
from manimlib.constants import OUT
from manimlib.mobject.mobject import Group
from manimlib.mobject.mobject import Mobject
from manimlib.utils.paths import path_a... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/numbers.py | manimlib/animation/numbers.py | from __future__ import annotations
from manimlib.animation.animation import Animation
from manimlib.mobject.numbers import DecimalNumber
from manimlib.utils.bezier import interpolate
from manimlib.utils.simple_functions import clip
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Callable
... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/creation.py | manimlib/animation/creation.py | from __future__ import annotations
from abc import ABC, abstractmethod
import numpy as np
from manimlib.animation.animation import Animation
from manimlib.mobject.svg.string_mobject import StringMobject
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.utils.bezier import integer_interpola... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/update.py | manimlib/animation/update.py | from __future__ import annotations
from manimlib.animation.animation import Animation
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Callable
from manimlib.mobject.mobject import Mobject
class UpdateFromFunc(Animation):
"""
update_function of the form func(mobject), presumab... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/growing.py | manimlib/animation/growing.py | from __future__ import annotations
from manimlib.animation.transform import Transform
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import numpy as np
from manimlib.mobject.geometry import Arrow
from manimlib.mobject.mobject import Mobject
from manimlib.typing import ManimColor
class GrowFrom... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/specialized.py | manimlib/animation/specialized.py | from __future__ import annotations
from manimlib.animation.composition import LaggedStart
from manimlib.animation.transform import Restore
from manimlib.constants import BLACK, WHITE
from manimlib.mobject.geometry import Circle
from manimlib.mobject.types.vectorized_mobject import VGroup
from typing import TYPE_CHECK... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/__init__.py | manimlib/animation/__init__.py | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false | |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/animation.py | manimlib/animation/animation.py | from __future__ import annotations
from copy import deepcopy
from manimlib.mobject.mobject import _AnimationBuilder
from manimlib.mobject.mobject import Mobject
from manimlib.utils.iterables import remove_list_redundancies
from manimlib.utils.rate_functions import smooth
from manimlib.utils.simple_functions import cl... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/movement.py | manimlib/animation/movement.py | from __future__ import annotations
from manimlib.animation.animation import Animation
from manimlib.utils.rate_functions import linear
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Callable, Sequence
import numpy as np
from manimlib.mobject.mobject import Mobject
from maniml... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/composition.py | manimlib/animation/composition.py | from __future__ import annotations
from manimlib.animation.animation import Animation
from manimlib.animation.animation import prepare_animation
from manimlib.mobject.mobject import _AnimationBuilder
from manimlib.mobject.mobject import Group
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.m... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/fading.py | manimlib/animation/fading.py | from __future__ import annotations
import numpy as np
from manimlib.animation.animation import Animation
from manimlib.animation.transform import Transform
from manimlib.constants import ORIGIN
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.mobject.mobject import Group
from manimlib.util... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/manimlib/animation/transform_matching_parts.py | manimlib/animation/transform_matching_parts.py | from __future__ import annotations
import itertools as it
from difflib import SequenceMatcher
from manimlib.animation.composition import AnimationGroup
from manimlib.animation.fading import FadeInFromPoint
from manimlib.animation.fading import FadeOutToPoint
from manimlib.animation.transform import Transform
from man... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/docs/example.py | docs/example.py | from manimlib import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(BLUE, opacity=0.5)
circle.set_stroke(BLUE_E, width=4)
square = Square()
self.play(ShowCreation(square))
self.wait()
self.play(ReplacementTransform(squa... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/docs/source/manim_example_ext.py | docs/source/manim_example_ext.py | from docutils import nodes
from docutils.parsers.rst import directives, Directive
import jinja2
import os
class skip_manim_node(nodes.Admonition, nodes.Element):
pass
def visit(self, node, name=""):
self.visit_admonition(node, name)
def depart(self, node):
self.depart_admonition(node)
class ManimEx... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/docs/source/conf.py | docs/source/conf.py | import os
import sys
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath('../../'))
project = 'manim'
copyright = '- This document has been placed in the public domain.'
author = 'TonyCrane'
release = ''
extensions = [
'sphinx.ext.todo',
'sphinx.ext.githubpages',
'sphinx.ext.math... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
3b1b/manim | https://github.com/3b1b/manim/blob/e5298385edabb34a09cf63743c1a4ec983f1ab11/logo/logo.py | logo/logo.py | from manimlib.imports import *
NEW_BLUE = "#68a8e1"
class Thumbnail(GraphScene):
CONFIG = {
"y_max": 8,
"y_axis_height": 5,
}
def construct(self):
self.show_function_graph()
def show_function_graph(self):
self.setup_axes(animate=False)
def func(x):
... | python | MIT | e5298385edabb34a09cf63743c1a4ec983f1ab11 | 2026-01-04T14:38:15.512738Z | false |
github/spec-kit | https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/src/specify_cli/__init__.py | src/specify_cli/__init__.py | #!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "typer",
# "rich",
# "platformdirs",
# "readchar",
# "httpx",
# ]
# ///
"""
Specify CLI - Setup tool for Specify projects
Usage:
uvx specify-cli.py init <project-name>
uvx specify-cli.py init .
uvx spe... | python | MIT | 9111699cd27879e3e6301651a03e502ecb6dd65d | 2026-01-04T14:38:38.693097Z | true |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/conftest.py | conftest.py | try:
# When using torch and tensorflow, torch needs to be imported first,
# otherwise it will segfault upon import. This should force the torch
# import to happen first for all tests.
import torch # noqa: F401
except ImportError:
torch = None
import pytest # noqa: E402
from keras.src.backend imp... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/api_gen.py | api_gen.py | """Script to generate keras public API in `keras/api` directory.
Usage:
Run via `./shell/api_gen.sh`.
It generates API and formats user and generated APIs.
"""
import os
import re
import shutil
import namex
PACKAGE = "keras"
BUILD_DIR_NAME = "tmp_build_dir"
def ignore_files(_, filenames):
return [f for f in ... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/pip_build.py | pip_build.py | """Script to create (and optionally install) a `.whl` archive for Keras 3.
Usage:
1. Create a `.whl` file in `dist/`:
```
python3 pip_build.py
```
2. Also install the new package immediately after:
```
python3 pip_build.py --install
```
"""
import argparse
import datetime
import glob
import os
import pathlib
impo... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/__init__.py | benchmarks/__init__.py | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false | |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/rnn_benchmark.py | benchmarks/layer_benchmark/rnn_benchmark.py | """Benchmark rnn layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.rnn_benchmark \
--benchmark_name=benchmark_lstm \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
```
"""
import tens... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/pooling_benchmark.py | benchmarks/layer_benchmark/pooling_benchmark.py | """Benchmark pooling layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.pooling_benchmark \
--benchmark_name=benchmark_max_pooling1d \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
```... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/activation_benchmark.py | benchmarks/layer_benchmark/activation_benchmark.py | """Benchmark activation layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.activation_benchmark \
--benchmark_name=benchmark_elu \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
```
"""... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/conv_benchmark.py | benchmarks/layer_benchmark/conv_benchmark.py | """Benchmark conv layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.conv_benchmark \
--benchmark_name=benchmark_conv2D \
--num_samples=2046 \
--batch_size=256 \
--jit_compile=True
```
"""
from ab... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/normalization_benchmark.py | benchmarks/layer_benchmark/normalization_benchmark.py | """Benchmark normalization layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.normalization_benchmark \
--benchmark_name=benchmark_batch_normalization \
--num_samples=2048 \
--batch_size=256 \
--ji... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/base_benchmark.py | benchmarks/layer_benchmark/base_benchmark.py | import time
import numpy as np
import tensorflow as tf
from absl import flags
import keras
FLAGS = flags.FLAGS
flags.DEFINE_string(
"benchmark_name",
None,
"The name of benchmark to run. If None, all benchmarks in the file will be "
"run.",
)
flags.DEFINE_integer(
"num_samples",
1000,
"... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/__init__.py | benchmarks/layer_benchmark/__init__.py | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false | |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/regularization_benchmark.py | benchmarks/layer_benchmark/regularization_benchmark.py | """Benchmark regularization layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.regularization_benchmark \
--benchmark_name=benchmark_dropout\
--num_samples=2048 \
--batch_size=256 \
--jit_compile=T... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/merge_benchmark.py | benchmarks/layer_benchmark/merge_benchmark.py | """Benchmark merge layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.merge_benchmark \
--benchmark_name=benchmark_add \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
```
"""
from abs... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/reshaping_benchmark.py | benchmarks/layer_benchmark/reshaping_benchmark.py | """Benchmark reshaping layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.reshaping_benchmark \
--benchmark_name=benchmark_cropping2d \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
``... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/attention_benchmark.py | benchmarks/layer_benchmark/attention_benchmark.py | """Benchmark attention layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.attention_benchmark \
--benchmark_name=benchmark_attention \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
```... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/layer_benchmark/core_benchmark.py | benchmarks/layer_benchmark/core_benchmark.py | """Benchmark core layers.
To run benchmarks, see the following command for an example, please change the
flag to your custom value:
```
python3 -m benchmarks.layer_benchmark.core_benchmark \
--benchmark_name=benchmark_dense \
--num_samples=2048 \
--batch_size=256 \
--jit_compile=True
```
"""
import n... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/model_benchmark/bert_benchmark.py | benchmarks/model_benchmark/bert_benchmark.py | """Benchmark BERT model on GLUE/MRPC task.
To run the script, make sure you are in benchmarks/ directory, abd run the
command below:
```
python3 -m model_benchmark.bert_benchmark \
--epochs 2 \
--batch_size 32
```
"""
import time
import keras_nlp
import numpy as np
import tensorflow as tf
import tensorflow_... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/model_benchmark/image_classification_benchmark.py | benchmarks/model_benchmark/image_classification_benchmark.py | """Image classification benchmark.
This script runs image classification benchmark with "dogs vs cats" datasets.
It supports the following 3 models:
- EfficientNetV2B0
- Xception
- ResNet50V2
To run the benchmark, make sure you are in model_benchmark/ directory, and run
the command below:
python3 -m model_benchmark... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/model_benchmark/__init__.py | benchmarks/model_benchmark/__init__.py | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false | |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/model_benchmark/benchmark_utils.py | benchmarks/model_benchmark/benchmark_utils.py | import time
import keras
class BenchmarkMetricsCallback(keras.callbacks.Callback):
def __init__(self, start_batch=1, stop_batch=None):
self.start_batch = start_batch
self.stop_batch = stop_batch
# Store the throughput of each epoch.
self.state = {"throughput": []}
def on_tra... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/torch_ctl_benchmark/conv_model_benchmark.py | benchmarks/torch_ctl_benchmark/conv_model_benchmark.py | """Benchmark Keras performance with torch custom training loop.
In this file we use a convolution model. Training loop is written in the
vanilla torch way, and we compare the performance between building model with
Keras and torch.
"""
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/torch_ctl_benchmark/dense_model_benchmark.py | benchmarks/torch_ctl_benchmark/dense_model_benchmark.py | """Benchmark Keras performance with torch custom training loop.
In this file we use a model with 3 dense layers. Training loop is written in the
vanilla torch way, and we compare the performance between building model with
Keras and torch.
"""
import numpy as np
import torch
import torch.nn as nn
import torch.optim a... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/torch_ctl_benchmark/__init__.py | benchmarks/torch_ctl_benchmark/__init__.py | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false | |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/benchmarks/torch_ctl_benchmark/benchmark_utils.py | benchmarks/torch_ctl_benchmark/benchmark_utils.py | import time
import numpy as np
import torch
def train_loop(model, train_loader, num_epochs, optimizer, loss_fn, framework):
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model.to(device)
start = None
average_batch_time_per_epoch = []
for _ in range(num_epochs):
r... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/import_test.py | integration_tests/import_test.py | import os
import re
import subprocess
from keras.src import backend
from keras.src.backend import config
# For torch, use index url to avoid installing nvidia drivers for the test.
BACKEND_REQ = {
"tensorflow": ("tensorflow-cpu", ""),
"torch": (
"torch",
"--extra-index-url https://download.pyt... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/torch_workflow_test.py | integration_tests/torch_workflow_test.py | import torch
from keras.src import layers
from keras.src import testing
from keras.src.backend.common import KerasVariable
class Net(torch.nn.Module):
def __init__(self):
super().__init__()
self.fc1 = layers.Dense(1)
def forward(self, x):
x = self.fc1(x)
return x
class Torc... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/torch_custom_fit_test.py | integration_tests/torch_custom_fit_test.py | import numpy as np
import torch
import keras
def test_custom_fit():
class CustomModel(keras.Model):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.loss_tracker = keras.metrics.Mean(name="loss")
self.mae_metric = keras.metrics.MeanAbsoluteEr... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/basic_full_flow.py | integration_tests/basic_full_flow.py | import numpy as np
import pytest
import keras
from keras.src import layers
from keras.src import losses
from keras.src import metrics
from keras.src import optimizers
from keras.src import testing
class MyModel(keras.Model):
def __init__(self, hidden_dim, output_dim, **kwargs):
super().__init__(**kwargs)... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/model_visualization_test.py | integration_tests/model_visualization_test.py | import re
import keras
from keras.src import testing
from keras.src.utils import model_to_dot
from keras.src.utils import plot_model
class SubclassModel(keras.models.Model):
def __init__(self, name):
super().__init__(name=name)
def call(self, x):
return x
def parse_text_from_html(html):
... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/jax_custom_fit_test.py | integration_tests/jax_custom_fit_test.py | import jax
import numpy as np
import keras
def test_custom_fit():
class CustomModel(keras.Model):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.loss_tracker = keras.metrics.Mean(name="loss")
self.mae_metric = keras.metrics.MeanAbsoluteErro... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/tf_custom_fit_test.py | integration_tests/tf_custom_fit_test.py | import numpy as np
import tensorflow as tf
import keras
def test_custom_fit():
class CustomModel(keras.Model):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.loss_tracker = keras.metrics.Mean(name="loss")
self.mae_metric = keras.metrics.Mea... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/numerical_test.py | integration_tests/numerical_test.py | import keras # isort: skip, keep it on top for torch test
import sys
import numpy as np
import tf_keras
keras.backend.set_image_data_format("channels_last")
tf_keras.backend.set_image_data_format("channels_last")
NUM_CLASSES = 10
BATCH_SIZE = 32
EPOCHS = 1
def build_mnist_data(num_classes):
(x_train, y_train... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/tf_distribute_training_test.py | integration_tests/tf_distribute_training_test.py | import numpy as np
import tensorflow as tf
import keras
from keras.src import layers
from keras.src import losses
from keras.src import metrics
from keras.src import models
from keras.src import optimizers
from keras.src.callbacks import LearningRateScheduler
def test_model_fit():
cpus = tf.config.list_physical_... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/dataset_tests/cifar100_test.py | integration_tests/dataset_tests/cifar100_test.py | import numpy as np
from keras.src import testing
from keras.src.datasets import cifar100
class Cifar100LoadDataTest(testing.TestCase):
def test_shapes_fine_label_mode(self):
(x_train, y_train), (x_test, y_test) = cifar100.load_data(
label_mode="fine"
)
self.assertEqual(x_train... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/dataset_tests/reuters_test.py | integration_tests/dataset_tests/reuters_test.py | import numpy as np
from keras.src import testing
from keras.src.datasets import reuters
class ReutersLoadDataTest(testing.TestCase):
def test_load_data_default(self):
(x_train, y_train), (x_test, y_test) = reuters.load_data()
# Check types
self.assertIsInstance(x_train, np.ndarray)
... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/dataset_tests/mnist_test.py | integration_tests/dataset_tests/mnist_test.py | import numpy as np
from keras.src import testing
from keras.src.datasets import mnist
class MnistLoadDataTest(testing.TestCase):
def test_x_train_shape(self):
(x_train, _), _ = mnist.load_data()
self.assertEqual(x_train.shape, (60000, 28, 28))
def test_y_train_shape(self):
(_, y_trai... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
keras-team/keras | https://github.com/keras-team/keras/blob/c67eddb4ff8b615886893ca996dc216bc923d598/integration_tests/dataset_tests/imdb_test.py | integration_tests/dataset_tests/imdb_test.py | import numpy as np
from keras.src import testing
from keras.src.datasets import imdb
class ImdbLoadDataTest(testing.TestCase):
def test_load_data_default(self):
(x_train, y_train), (x_test, y_test) = imdb.load_data()
self.assertIsInstance(x_train, np.ndarray)
self.assertIsInstance(y_train... | python | Apache-2.0 | c67eddb4ff8b615886893ca996dc216bc923d598 | 2026-01-04T14:38:29.819962Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.