Skip to content

Instantly share code, notes, and snippets.

import numpy as np
from scipy import linalg
from sklearn.utils import array2d, as_float_array
from sklearn.base import TransformerMixin, BaseEstimator
class ZCA(BaseEstimator, TransformerMixin):
def __init__(self, regularization=10**-5, copy=False):
self.regularization = regularization
import numpy as np
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../build/python'))
from singa import device
from singa import tensor
import net as ffnet
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@nudles
nudles / model.py
Last active October 19, 2016 12:20
cifar10 for rafiki with train and serve
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@nudles
nudles / .gitignore
Last active January 4, 2017 09:12 — forked from aaronwwf/.gitignore
rafiki-cifar10-vgg
.project
.pydevproject
data_
parameter_
*.pyc
@nudles
nudles / .gitignore
Last active February 10, 2021 07:53
train alexnet over cifar10 and do prediction
.project
.pydevproject
data_
parameter_
*.pyc
@nudles
nudles / .gitignore
Last active November 1, 2016 10:52
char-rnn
*.pyc
@nudles
nudles / example.py
Last active February 2, 2017 14:19
from singa import layer
from singa import net as ffnet
from singa import loss
from singa import device
from singa import tensor
# create the net
net = ffnet.FeedForwardNet(loss.SoftmaxCrossEntropy())
net.add(layer.Conv2D('conv', 32, 5, 1, pad=2, (3, 32, 32)))
net.add(layer.Activation('relu'))
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@nudles
nudles / README.md
Last active February 24, 2017 04:54
resnet50 for imagenet