public List<INDArray> inferVectorBatched(@NonNull List<String> documents) {
        if (countSubmitted == null)
            initInference();

        if (this.vocab == null || this.vocab.numWords() == 0)
            reassignExistingModel();

        List<Future<INDArray>> futuresList = new ArrayList<>();
        List<INDArray> results = new ArrayList<>();

        final AtomicLong flag = new AtomicLong(0);

        for (int i = 0; i < documents.size(); i++) {
            BlindInferenceCallable callable =
                            new BlindInferenceCallable(vocab, tokenizerFactory, documents.get(i), flag);

            futuresList.add(inferenceExecutor.submit(callable));
        }

        for (int i = 0; i < documents.size(); i++) {
            Future<INDArray> future = futuresList.get(i);
            try {
                results.add(future.get());
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                throw new RuntimeException(e);
            } catch (ExecutionException e) {
                throw new RuntimeException(e);
            }
        }

        return results;
    }
public List < INDArray > inferVectorBatched ( @ NonNull List < String > documents ) { if ( countSubmitted == null ) initInference ( ) ; if ( this . vocab == null || this . vocab . numWords ( ) == 0 ) reassignExistingModel ( ) ; List < Future < INDArray > > futuresList = new ArrayList < > ( ) ; List < INDArray > results = new ArrayList < > ( ) ; final AtomicLong flag = new AtomicLong ( 0 ) ; for ( int i = 0 ; i < documents . size ( ) ; i ++ ) { BlindInferenceCallable callable = new BlindInferenceCallable ( vocab , tokenizerFactory , documents . get ( i ) , flag ) ; futuresList . add ( inferenceExecutor . submit ( callable ) ) ; } for ( int i = 0 ; i < documents . size ( ) ; i ++ ) { Future < INDArray > future = futuresList . get ( i ) ; try { results . add ( future . get ( ) ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new RuntimeException ( e ) ; } catch ( ExecutionException e ) { throw new RuntimeException ( e ) ; } } return results ; }
This method does inference on a given List&lt;String&gt;
@param documents
@return INDArrays in the same order as input texts