Source:
public Optional<NeuralNetAlgorithmOutput> getNetOutput(final String netId, final double [][] sensorData) { if (sensorData == null || sensorData.length == 0) { return Optional.absent(); } final NeuralNetMessages.NeuralNetInput.Builder builder = NeuralNetMessages.NeuralNetInput.newBuilder(); builder.setNetId(netId); for (int i = 0; i < sensorData.length; i++) { final NeuralNetMessages.DataVector.Builder vecBuilder = NeuralNetMessages.DataVector.newBuilder(); for (int t = 0; t < sensorData[i].length;t++) { vecBuilder.addVec(sensorData[i][t]); } builder.addMat(vecBuilder); } try { final HttpPost httppost = new HttpPost(endpoint + EVALUATION_ENDPOINT); final InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(builder.build().toByteArray()), -1, ContentType.APPLICATION_OCTET_STREAM); reqEntity.setChunked(true); httppost.setEntity(reqEntity); final long startTime = DateTime.now().getMillis(); final HttpResponse response = httpClient.execute(httppost); final long endTime = DateTime.now().getMillis(); LOGGER.info("action=posted_neuralnet duration={} endpoint={}",endTime - startTime); final NeuralNetMessages.NeuralNetOutput output = NeuralNetMessages.NeuralNetOutput.parseFrom(response.getEntity().getContent()); final double [][] outputMatrix = new double[output.getMatCount()][0]; for (int i = 0; i < output.getMatCount(); i++) { final List<Double> vec = output.getMat(i).getVecList(); outputMatrix[i] = new double [vec.size()]; for (int t = 0; t < vec.size(); t++) { outputMatrix[i][t] = vec.get(t); } } return Optional.of(new NeuralNetAlgorithmOutput(outputMatrix)); } catch (IOException e) { LOGGER.error(e.getMessage()); } return Optional.absent(); }

Target:
public Optional<NeuralNetAlgorithmOutput> getNetOutput(final String netId, final double [][] sensorData) { if (sensorData == null || sensorData.length == 0) { return Optional.absent(); } final NeuralNetMessages.NeuralNetInput.Builder builder = NeuralNetMessages.NeuralNetInput.newBuilder(); builder.setNetId(netId); for (int i = 0; i < sensorData.length; i++) { final NeuralNetMessages.DataVector.Builder vecBuilder = NeuralNetMessages.DataVector.newBuilder(); for (int t = 0; t < sensorData[i].length;t++) { vecBuilder.addVec(sensorData[i][t]); } builder.addMat(vecBuilder); } try { final HttpPost httppost = new HttpPost(endpoint + EVALUATION_ENDPOINT); final InputStreamEntity reqEntity = new InputStreamEntity(new ByteArrayInputStream(builder.build().toByteArray()), -1, ContentType.APPLICATION_OCTET_STREAM); reqEntity.setChunked(true); httppost.setEntity(reqEntity); final long startTime = DateTime.now().getMillis(); final HttpResponse response = httpClient.execute(httppost); final long endTime = DateTime.now().getMillis(); LOGGER.info("action=posted_neuralnet duration={} net_id={}",endTime - startTime,netId); final NeuralNetMessages.NeuralNetOutput output = NeuralNetMessages.NeuralNetOutput.parseFrom(response.getEntity().getContent()); final double [][] outputMatrix = new double[output.getMatCount()][0]; for (int i = 0; i < output.getMatCount(); i++) { final List<Double> vec = output.getMat(i).getVecList(); outputMatrix[i] = new double [vec.size()]; for (int t = 0; t < vec.size(); t++) { outputMatrix[i][t] = vec.get(t); } } return Optional.of(new NeuralNetAlgorithmOutput(outputMatrix)); } catch (IOException e) { LOGGER.error("action=caught_exception exception=IOException message=\"{}\" ",e.getMessage()); LOGGER.debug(e.getMessage()); } return Optional.absent(); }