Skip to content

Instantly share code, notes, and snippets.

View kalradivyanshu's full-sized avatar
🐴

Divyanshu Kalra kalradivyanshu

🐴
View GitHub Profile
# install flashinfer by running:
# pip install flashinfer -i https://flashinfer.ai/whl/cu121/torch2.3/
import torch
import flashinfer
from math import sqrt, ceil
torch.manual_seed(0)
num_layers = 32
@kalradivyanshu
kalradivyanshu / tflite_pytorch_model_summary.py
Last active November 23, 2023 18:00
how to get model total trainable parameters for tflite and pytorch
import numpy as np
def count_parameters_tflite(model):
details = model.get_tensor_details()
# Calculate the total number of trainable parameters
total_params = 0
for detail in details:
shape = detail['shape']
if 'weight' in detail['name'] or 'bias' in detail['name']:
total_params += np.prod(shape)
// CC: cc -O3 -Wall -Wextra $(pkg-config --cflags --static SvtAv1Enc) enc.c $(pkg-config --libs --static SvtAv1Enc)
#include <pthread.h> // for pthread_exit, pthread_create, pthread_join
#include <stdbool.h> // for bool, false
#include <stdint.h> // for uint8_t, uint64_t, uint16_t, uint32_t
#include <stdio.h> // for size_t, NULL, fprintf, fputs, fwrite
#include <stdlib.h> // for calloc, free, strtoul
#include "EbSvtAv1.h" // for EbSvtIOFormat, EbBufferHeaderType, EB_E...
#include "EbSvtAv1Enc.h" // for svt_av1_enc_parse_parameter, svt_av1_en...
#include "EbSvtAv1Formats.h" // for EB_EIGHT_BIT, EB_YUV420
package main
import (
"fmt"
"os"
"time"
"github.com/pion/rtcp"
"github.com/pion/webrtc/v2"
"github.com/pion/webrtc/v2/pkg/media"
@kalradivyanshu
kalradivyanshu / # mysql - 2018-07-17_11-59-12.txt
Created September 4, 2018 07:02
mysql on macOS 10.13.5 - Homebrew build logs
Homebrew build logs for mysql on macOS 10.13.5
Build date: 2018-07-17 11:59:12
import tensorflow as tf
import time
m1 = []
m2 = []
result = []
i = 10
while i <= 10000:
m1.append(tf.random_uniform(shape = [i, i]))
m2.append(tf.random_uniform(shape = [i, i]))
i *= 10
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
from tensorflow.examples.tutorials.mnist import input_data
from time import time
import sys
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
image_size = 28
x = tf.placeholder(tf.float32, [None, 784])
from tensorflow.examples.tutorials.mnist import input_data
import sys
layers = int(sys.argv[1])
import tensorflow as tf
from time import time
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
x = tf.placeholder(tf.float32, [None, 784])
hiddenLayer = tf.layers.dense(x, 1000, activation = tf.nn.tanh)