Skip to content

Commit

Permalink
remove unnecessary initialization, flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmah committed Nov 30, 2015
1 parent f245145 commit 6d6dcb4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions theano/sandbox/multinomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from theano.sandbox.cuda.basic_ops import host_from_gpu, gpu_from_host
from theano.sandbox.cuda.opt import register_opt


class MultinomialFromUniform(Op):
"""
Converts samples from a uniform into sample from a multinomial.
Expand Down Expand Up @@ -92,7 +93,7 @@ def c_code(self, node, name, ins, outs, sub):
)
{
Py_XDECREF(%(z)s);
%(z)s = (PyArrayObject*) PyArray_ZEROS(2,
%(z)s = (PyArrayObject*) PyArray_EMPTY(2,
PyArray_DIMS(%(pvals)s),
%(t)s,
0);
Expand All @@ -108,7 +109,7 @@ def c_code(self, node, name, ins, outs, sub):
const int nb_multi = PyArray_DIMS(%(pvals)s)[0];
const int nb_outcomes = PyArray_DIMS(%(pvals)s)[1];
const int n_samples = %(n)s;
//
// For each multinomial, loop over each possible outcome
//
Expand Down Expand Up @@ -168,7 +169,7 @@ def perform(self, node, ins, outs):
waiting = True
cummul = 0
unis_n = unis[n]

for m in range(nb_outcomes):
cummul += pvals[n, m]
if c == 0:
Expand Down

0 comments on commit 6d6dcb4

Please sign in to comment.