Created
March 14, 2015 20:27
-
-
Save bmcfee/46de6a5e1d70618db957 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"<class 'lasagne.layers.conv.Conv2DLayer'>, valid, same, (1, 16, 96, 16)\n", | |
"<class 'lasagne.layers.conv.Conv2DLayer'>, valid, diff, (1, 16, 96, 16)\n", | |
"<class 'lasagne.layers.conv.Conv2DLayer'>, full, same, (1, 16, 104, 24)\n", | |
"<class 'lasagne.layers.conv.Conv2DLayer'>, full, diff, (1, 16, 104, 24)\n", | |
"<class 'lasagne.layers.conv.Conv2DLayer'>, same, same, (1, 16, 100, 20)\n", | |
"<class 'lasagne.layers.conv.Conv2DLayer'>, same, diff, (1, 16, 100, 20)\n" | |
] | |
} | |
], | |
"source": [ | |
"import numpy as np\n", | |
"import theano\n", | |
"import lasagne\n", | |
"import itertools\n", | |
"\n", | |
"# Create network, starting with input layer\n", | |
"l_in = lasagne.layers.InputLayer(shape=(None, 16, 100, 20))\n", | |
"\n", | |
"x_same = np.random.randn(1, 16, 100, 20).astype(theano.config.floatX)\n", | |
"x_diff = np.random.randn(1, 16, 200, 20).astype(theano.config.floatX)\n", | |
"\n", | |
"for layer, mode in itertools.product([lasagne.layers.Conv2DLayer],\n", | |
" ['valid', 'full', 'same']):\n", | |
" \n", | |
" l_1 = layer(l_in, num_filters=16, filter_size=(5, 5), border_mode=mode)\n", | |
" \n", | |
" out = theano.function([l_in.input_var], l_1.get_output())\n", | |
" \n", | |
" for x, shape in zip([x_same, x_diff], ['same', 'diff']):\n", | |
" print \"{}, {}, {}, {}\".format(layer, mode, shape, out(x).shape)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"1.8.2\n", | |
"0.7.0rc2.dev-d2c39c4ebd21eeb066681db0c74fd9ab3b0798e8\n" | |
] | |
}, | |
{ | |
"ename": "AttributeError", | |
"evalue": "'module' object has no attribute '__version__'", | |
"output_type": "error", | |
"traceback": [ | |
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | |
"\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", | |
"\u001b[1;32m<ipython-input-3-97d63e01435e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__version__\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[0mtheano\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__version__\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mprint\u001b[0m \u001b[0mlasagne\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__version__\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |
"\u001b[1;31mAttributeError\u001b[0m: 'module' object has no attribute '__version__'" | |
] | |
} | |
], | |
"source": [ | |
"print np.__version__\n", | |
"print theano.__version__\n", | |
"print lasagne.__version__" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 2", | |
"language": "python", | |
"name": "python2" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment