<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "image_tensor = tf.placeholder(tf.float32, shape=[1, 227, 227, 3], name='input_tensor')\n",
    "kernel_tensor = tf.placeholder(tf.float32, shape=[11, 11, 3, 48], name='kernel_tensor')\n",
    "conv2d_out = tf.nn.conv2d(image_tensor, kernel_tensor, strides=[1, 4, 4, 1], padding='VALID', name='output')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def run_conv2d(sess, image, kernel):\n",
    "    out = sess.run([conv2d_out], feed_dict={image_tensor:image, kernel_tensor:kernel})\n",
    "    return out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(24.61499999999983, 'ms')\n"
     ]
    }
   ],
   "source": [
    "sess = tf.Session()\n",
    "sess.run(tf.global_variables_initializer())\n",
    "image = np.random.randn(1, 227, 227, 3)\n",
    "kernel = np.random.randn(11, 11, 3, 48)\n",
    "start = time.clock()\n",
    "run_conv2d(sess, image, kernel)\n",
    "end = time.clock()\n",
    "print((end - start)*1000, 'ms')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100 loops, best of 3: 6.02 ms per loop\n"
     ]
    }
   ],
   "source": [
    "%timeit run_conv2d(sess, image, kernel)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
<commit_msg>update fpga2018 test<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "image_tensor = tf.placeholder(tf.float32, shape=[100, 227, 227, 3], name='input_tensor')\n",
    "kernel_tensor = tf.placeholder(tf.float32, shape=[11, 11, 3, 96], name='kernel_tensor')\n",
    "conv2d_out = tf.nn.conv2d(image_tensor, kernel_tensor, strides=[1, 4, 4, 1], padding='VALID', name='output')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def run_conv2d(sess, image, kernel):\n",
    "    out = sess.run([conv2d_out], feed_dict={image_tensor:image, kernel_tensor:kernel})\n",
    "    return out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3009.6779999999994, 'ms')\n"
     ]
    }
   ],
   "source": [
    "sess = tf.Session()\n",
    "sess.run(tf.global_variables_initializer())\n",
    "image = np.random.randn(100, 227, 227, 3)\n",
    "kernel = np.random.randn(11, 11, 3, 96)\n",
    "start = time.clock()\n",
    "run_conv2d(sess, image, kernel)\n",
    "end = time.clock()\n",
    "print((end - start)*1000, 'ms')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 loop, best of 3: 885 ms per loop\n"
     ]
    }
   ],
   "source": [
    "%timeit run_conv2d(sess, image, kernel)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "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.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

{'fraction_non_alphanumeric': 0.21647011792924245, 'fraction_numerical': 0.035978412952228665, 'mean_word_length': 2.734328358208955, 'pattern_counts': {'":': 120, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7035081', 'n_tokens_mistral': 2125, 'n_tokens_neox': 1969, 'n_words': 358}