Java Code Examples for org.nd4j.linalg.dataset.api.MultiDataSet#getLabelsMaskArrays()
The following examples show how to use
org.nd4j.linalg.dataset.api.MultiDataSet#getLabelsMaskArrays() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultCallback.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public void call(MultiDataSet multiDataSet) { if (multiDataSet != null) { if (multiDataSet.getFeatures() != null) for (int i = 0; i < multiDataSet.getFeatures().length; i++) Nd4j.getAffinityManager().ensureLocation(multiDataSet.getFeatures()[i], AffinityManager.Location.DEVICE); if (multiDataSet.getLabels() != null) for (int i = 0; i < multiDataSet.getLabels().length; i++) Nd4j.getAffinityManager().ensureLocation(multiDataSet.getLabels()[i], AffinityManager.Location.DEVICE); if (multiDataSet.getFeaturesMaskArrays() != null) for (int i = 0; i < multiDataSet.getFeaturesMaskArrays().length; i++) Nd4j.getAffinityManager().ensureLocation(multiDataSet.getFeaturesMaskArrays()[i], AffinityManager.Location.DEVICE); if (multiDataSet.getLabelsMaskArrays() != null) for (int i = 0; i < multiDataSet.getLabelsMaskArrays().length; i++) Nd4j.getAffinityManager().ensureLocation(multiDataSet.getLabelsMaskArrays()[i], AffinityManager.Location.DEVICE); } }
Example 2
Source File: MultiLayerNetwork.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public void fit(MultiDataSet dataSet) { if (dataSet.getFeatures().length == 1 && dataSet.getLabels().length == 1) { INDArray features = dataSet.getFeatures(0); INDArray labels = dataSet.getLabels(0); INDArray fMask = null; INDArray lMask = null; if (dataSet.getFeaturesMaskArrays() != null) fMask = dataSet.getFeaturesMaskArrays()[0]; if (dataSet.getFeaturesMaskArrays() != null) lMask = dataSet.getLabelsMaskArrays()[0]; DataSet ds = new DataSet(features, labels, fMask, lMask); fit(ds); } else { throw new DL4JInvalidInputException( "MultiLayerNetwork can't handle MultiDataSet with more than 1 features or labels array." + "Please consider use of ComputationGraph"); } }
Example 3
Source File: MultiDataSetWrapperIterator.java From deeplearning4j with Apache License 2.0 | 6 votes |
@Override public DataSet next() { MultiDataSet mds = iterator.next(); if (mds.getFeatures().length > 1 || mds.getLabels().length > 1) throw new UnsupportedOperationException( "This iterator is able to convert MultiDataSet with number of inputs/outputs of 1"); INDArray features = mds.getFeatures()[0]; INDArray labels = mds.getLabels() != null ? mds.getLabels()[0] : features; INDArray fMask = mds.getFeaturesMaskArrays() != null ? mds.getFeaturesMaskArrays()[0] : null; INDArray lMask = mds.getLabelsMaskArrays() != null ? mds.getLabelsMaskArrays()[0] : null; DataSet ds = new DataSet(features, labels, fMask, lMask); if (preProcessor != null) preProcessor.preProcess(ds); return ds; }