Discussion:
[theano-users] How theano.function can be the input of another function in python?
Golnoush
2018-08-28 23:42:23 UTC
Permalink
I have two .py files. In one of them, I have this function:



def score_semeval2015_term(pred_fn, nnet_outdir, data_dir):
def predict(dataset):
x_test = numpy.load(os.path.join(data_dir, 'semeval_{}_x.npy').format(dataset))
x_test_term = numpy.load(os.path.join(data_dir, 'semeval_{}_x_term.npy').format(dataset))
print dataset, x_test.shape
predictions = pred_fn(x_test, x_test_term)
y2label = {0: 'negative', 1: 'neutral', 2: 'positive'}
labels = [y2label[y] for y in predictions]
return labels


while pred_fn is a theano.function defined in another .py file as follows:


pred_fn = theano.function(inputs=inputs_pred,
outputs=predictions,
givens=givens_pred)


My question is that how is it possible that a function be as an input to
the other function? How should I get the input of
score_semeval2015_term(pred_fn, nnet_outdir, data_dir) function when I call
it? Thank you.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...