Compile the code with:
$ g++ sine_opengl.cpp -o sine-gl -lGL -lGLU -lglut
There will now be a sine-gl
binary, which can be run:
$ ./sine-gl
# /// script | |
# requires-python = ">=3.14" | |
# /// | |
import concurrent.interpreters as ci | |
from time import sleep | |
def consume_queue(qin: ci.Queue, qout: ci.Queue, id: int = 0): | |
while True: | |
item = qin.get() | |
if item is None: # Use None as a sentinel to stop the consumer |
abd | |
ccd | |
adadfsgsgs | |
sadagfa |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define BINS 256 | |
#define NUM_BYTES (sizeof(int) / sizeof(char)) | |
#define K 3 | |
void find_top_k(int *data, int n, int byte_pos, int k, int *top_k, int *current_k) { | |
if (n == 0 || *current_k >= k || byte_pos >= NUM_BYTES) { |
from torch.nn import Sequential, Linear, ReLU, Tanh | |
# Model had an 'actor' attribute that was a Sequential type in this case | |
model = torch.jit.load(path) | |
model_modules = model.actor._modules._python_modules | |
def convert_module(module): | |
if module.original_name == "Sequential": | |
layers = [] | |
for sub_key in module._modules._python_modules: |
# Use torch to smooth the pixel art | |
import os | |
# Set environment QT_QPA_PLATFORM | |
os.environ['QT_QPA_PLATFORM'] = 'offscreen' | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import numpy as np | |
import cv2 |
Compile the code with:
$ g++ sine_opengl.cpp -o sine-gl -lGL -lGLU -lglut
There will now be a sine-gl
binary, which can be run:
$ ./sine-gl