Skip to content

Instantly share code, notes, and snippets.

@nudles
Last active February 2, 2017 14:19
Show Gist options
  • Save nudles/c06bbc3a40d94dbfb9ff08b4d3009a76 to your computer and use it in GitHub Desktop.
Save nudles/c06bbc3a40d94dbfb9ff08b4d3009a76 to your computer and use it in GitHub Desktop.
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'))
net.add(layer.MaxPooling2D('pool', 3, 2))
net.add(layer.Flatten('flat'))
net.add(layer.Dense('dense', 10))
net.load('checkpoint/step100')
dev = device.create_cuda_gpu()
net.to_device(dev)
x = tensor.from_numpy(image)
x.to_device(dev)
y= net.predict(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment