Skip to content

Instantly share code, notes, and snippets.

View thomasahle's full-sized avatar
♟️

Thomas Dybdahl Ahle thomasahle

♟️
View GitHub Profile
1: def _generated_forward(i:int, k:int, _var_5305017088:torch.Tensor, _var_5305017136:torch.Tensor, _var_5305023376:torch.Tensor) -> tuple[torch.Tensor]:
2: sum_ = 0 # (i, k)
3: # Product of 2 tensors
4: var_x = _var_5305023376 # (i, j)
5: var_w = _var_5305017088 # (j, k)
6: # var_x: (i, j)
7: # var_w: (j, k)
8: prod_ = ctg.array_contract(
9: arrays=[var_x, var_w],
10: inputs=[('i', 'j'), ('j', 'k')],
1: def _generated_forward(i:int, k:int, _var_5305017088:torch.Tensor, _var_5305017136:torch.Tensor, _var_5305023376:torch.Tensor) -> tuple[torch.Tensor]:
2: sum_ = 0 # (i, k)
3: # Product of 2 tensors
4: var_x = _var_5305023376 # (i, j)
5: var_w = _var_5305017088 # (j, k)
6: # var_x: (i, j)
7: # var_w: (j, k)
8: prod_ = ctg.array_contract(
9: arrays=[var_x, var_w],
10: inputs=[('i', 'j'), ('j', 'k')],
import numpy as np
from sklearn.linear_model import LinearRegression
# Generate some example data
np.random.seed(42)
n_samples = 100
# Create synthetic features (x1: thickness, x2: stiffness, x3: scent, x4: another property)
X = np.random.rand(n_samples, 4) * 10 # Random values between 0 and 10
import numpy as np
import matplotlib.pyplot as plt
# Parameters
d = 5
n = 5
maxP = 10
n_samples = 10000
def formula_p1(n, d):
import numpy as np
import matplotlib.pyplot as plt
# Parameters
d = 10
maxP = 10
n_samples = 100
# Identity matrix
ii = np.eye(d)
import asyncio
import asyncssh
import re
from nicegui import ui
# SSH connection details
SSH_HOST = 'remote_host'
SSH_PORT = 22
SSH_USERNAME = 'username'
SSH_PASSWORD = 'password'
from manim import *
import numpy as np
class DualRingHeatTransferAnimation(Scene):
def construct(self):
# Configuration
num_blocks = 20
num_around = 39
block_size = 0.4
outer_radius = 3.3
from manim import *
import numpy as np
class DualRingHeatTransferAnimation(Scene):
def construct(self):
# Configuration
num_blocks = 20
block_size = 0.4
outer_radius = 3.3
inner_radius = 2.9
@thomasahle
thomasahle / blocks.py
Created September 8, 2024 18:54
Manim heat exchange
from manim import *
import numpy as np
class HeatTransferAnimation(Scene):
def construct(self):
# Configuration
num_blocks = 10
block_size = 1
spacing = 0.1
import geopandas as gpd
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.colors as mcolors
from shapely.geometry import Polygon, MultiPolygon
import shapely.ops
import os.path
def get_text_color(fill_color):