Skip to content

Instantly share code, notes, and snippets.

View neil-tan's full-sized avatar

Neil Tan neil-tan

View GitHub Profile
from ..DNAS.search_space import SearchSpace
from ..DNAS.modules import ReshapeFC, Identity, Resizer, ConvBlock1D, SinBlock, ConvBlock2D, ConvChannel2D
from ..DNAS.modules import Resizer, MixedOp
from ..DNAS.super_net import DNAS
from ..fermi_datasets import FashionMNISTDataModule
from ..DNAS.entryNode import DataModuleWrapper
import pytorch_lightning as pl
from pytorch_lightning import seed_everything
@neil-tan
neil-tan / ArgDict.py
Created January 29, 2021 16:18
An argument parsing utility
# Example/Test Case
def test_reverse_arg_dict_multi(capsys):
def dummy_func(a, b=1, c=2, d=3):
assert a == 10
assert b == 20
assert c == 30
assert d == 40
arg_tester = ArgDict()
arg_tester.append(10, 20)
@neil-tan
neil-tan / utensor_web_cpp.cpp
Created June 18, 2020 08:04
C++ Code Snippet for uTensor Web
// Assume Initialized memory allocators
// Create a 2x2 Tensor from data owned by the user
int8_t my_input_buffer[4] = {1, 2, 3, 4};
Tensor a = new BufferTensor({2, 2}, i8, my_input_buffer);
// Update a value in our buffer.
my_input_buffer[3] = 5;
// Create Tensors of int8_t from const static arrays in ROM
Tensor b = new RomTensor({2, 2}, i8, array_of_values_b);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@neil-tan
neil-tan / main.cpp
Last active February 8, 2019 15:20
main.cpp for uTensor tutorial
#include "models/deep_mlp.hpp" //gernerated model file
#include "tensor.hpp" //useful tensor classes
#include "mbed.h"
#include <stdio.h>
#include "input_data.h" //contains the first sample taken from the MNIST test set
Serial pc(USBTX, USBRX, 115200); //baudrate := 115200
int main(void) {
printf("Simple MNIST end-to-end uTensor cli example (device)\n");
@neil-tan
neil-tan / input_data.h
Created February 8, 2019 13:31
input data file for the moist tutorial
const float input_data [ 784 ] = { 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.
@neil-tan
neil-tan / deep_mlp.ipynb
Created February 6, 2019 10:17
This file is located at uTensor/utensor-mnist-demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
# This script is based on:
# https://www.tensorflow.org/get_started/mnist/pros
# see https://github.com/uTensor/utensor-mnist-demo
"""
from __future__ import print_function
import argparse
import sys