Skip to content

Instantly share code, notes, and snippets.

View maxwillzq's full-sized avatar

John maxwillzq

  • Google
View GitHub Profile
@maxwillzq
maxwillzq / test_backend.py
Created February 16, 2024 01:55
jaxonnxruntime test_backend.py for score_board
"""ONNX backend test initialization."""
# copy from: https://github.com/onnx/backend-scoreboard/blob/master/test/test_backend.py
# Cmd: pytest test_backend.py -k 'not _cuda' --tb=short
import importlib
import os
import unittest
import onnx.backend.test
============================= test session starts ==============================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
rootdir: /usr/local/google/home/johnqiangzhang/Documents/jaxonnxruntime
configfile: pyproject.toml
collected 3924 items
tests/onnx_ops_test.py .ss..ssss..ssssFsFsssFsFsss.ss.ss.ssFssFss.ss.ss. [ 1%]
ss.ss.ss.ss.ss.ss.s.sss.s.sss.s.sss.s.sss.s.sss.s.sss.s.sss.s.sss.s.sss. [ 3%]
s.sss.s.sss.s.sss.s.sss.s.sss.s.sss.s.sss..ssss..ssss..ssss..ssss.ssxss. [ 4%]
ssxss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss.ss...ssss.sss.. [ 6%]
#!/usr/bin/python3
import numpy as np
import onnx
import os
import sys
import json
from google.protobuf.json_format import MessageToJson
from google.protobuf.json_format import Parse
import torch
import torch.onnx
int indexToLoc(const vector<int>& strides, vector<int> ids){
int result = 0;
for(int i = 0; i < strides.size(); i++) {
result += ids[i] * strides[i];
}
return result;
}
vector<int> locToIndex(const vector<int>& strides, int loc) {
vector<int> result;
@maxwillzq
maxwillzq / css_resources.md
Created August 16, 2014 05:40 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@maxwillzq
maxwillzq / javascript_resources.md
Created August 16, 2014 05:40 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@maxwillzq
maxwillzq / ASMLStock.ipynb
Created January 22, 2014 19:16
Example for the QSTK package
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.
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 02 11:03:42 2013
@author: qzhang
"""
import functools
a = [ 1,50,2,4,16]
def MyCmp(x,y):
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 01 17:24:03 2013
@author: qzhang
"""
import functools
def myfunc(a, b=2):