Skip to content

Commit

Permalink
support multi input models for nnframes (intel-analytics#1553)
Browse files Browse the repository at this point in the history
* support multi input for nnframes

* update ut

* add doc and unit test

* doc update

* scala style
  • Loading branch information
hhbyyh committed Aug 20, 2019
1 parent cb16521 commit 50885fe
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/dllib/src/bigdl/dllib/nnframes/nn_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ def __init__(self, model, criterion,
label_preprocessing = SeqToTensor()

if type(feature_preprocessing) is list:
assert(all(isinstance(x, int) for x in feature_preprocessing))
feature_preprocessing = SeqToTensor(feature_preprocessing)
if type(feature_preprocessing[0]) is list:
feature_preprocessing = SeqToMultipleTensors(feature_preprocessing)
elif isinstance(feature_preprocessing[0], int):
feature_preprocessing = SeqToTensor(feature_preprocessing)

if type(label_preprocessing) is list:
assert(all(isinstance(x, int) for x in label_preprocessing))
Expand Down Expand Up @@ -461,8 +463,10 @@ def __init__(self, model, feature_preprocessing=None, jvalue=None, bigdl_type="f
feature_preprocessing = SeqToTensor()

if type(feature_preprocessing) is list:
assert(all(isinstance(x, int) for x in feature_preprocessing))
feature_preprocessing = SeqToTensor(feature_preprocessing)
if type(feature_preprocessing[0]) is list:
feature_preprocessing = SeqToMultipleTensors(feature_preprocessing)
elif isinstance(feature_preprocessing[0], int):
feature_preprocessing = SeqToTensor(feature_preprocessing)

sample_preprocessing = ChainedPreprocessing([feature_preprocessing, TensorToSample()])
self.value = callBigDlFunc(
Expand Down

0 comments on commit 50885fe

Please sign in to comment.