Skip to content

Commit

Permalink
docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
justheuristic committed Mar 22, 2017
1 parent 4a5dacc commit c324229
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions week6.5/seq2seq.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
},
"outputs": [],
"source": [
"%env THEANO_FLAGS=device=gpu7\n",
"import numpy as np\n",
"import theano\n",
"import theano.tensor as T\n",
"import lasagne\n",
"import os\n",
"import pandas as pd\n",
"from tqdm import tqdm_notebook\n",
"\n",
"#thanks Muammar \n",
"PAD_ix=-1"
"import pandas as pd"
]
},
{
Expand Down Expand Up @@ -120,7 +115,11 @@
},
"outputs": [],
"source": [
"def as_matrix(sequences,token_to_i, max_len=None,PAX_ix=PAD_ix):\n",
"def as_matrix(sequences,token_to_i, max_len=None,PAX_ix=-1):\n",
" \"\"\"\n",
" Converts several sequences of tokens to a matrix, edible a neural network.\n",
" Crops at max_len(if given), pads shorter sequences with -1 or PAD_ix.\n",
" \"\"\"\n",
" max_len = max_len or max(map(len,sequences))\n",
" \n",
" matrix = np.zeros((len(sequences),max_len),dtype='int8') -1\n",
Expand Down

0 comments on commit c324229

Please sign in to comment.