本文整理了Java中org.nd4j.linalg.factory.Nd4j.readNumpy()
方法的一些代码示例,展示了Nd4j.readNumpy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Nd4j.readNumpy()
方法的具体详情如下:
包路径:org.nd4j.linalg.factory.Nd4j
类名称:Nd4j
方法名:readNumpy
[英]Read line via input streams
[中]通过输入流读取行
代码示例来源:origin: deeplearning4j/nd4j
/**
* Read line via input streams
*
* @param filePath the input stream ndarray
* @return the read txt method
*/
public static INDArray readNumpy(String filePath) throws IOException {
return readNumpy(filePath, "\t");
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Read line via input streams
*
* @param filePath the input stream ndarray
* @param split the split separator
* @return the read txt method
*/
public static INDArray readNumpy(String filePath, String split) throws IOException {
return readNumpy(new FileInputStream(filePath), split);
}
代码示例来源:origin: deeplearning4j/dl4j-examples
readFromText = Nd4j.readNumpy(makeResourcePath("/numpy_cheatsheet/file.txt"));
print("Read from text", readFromText);
} catch (IOException e) {
readFromCSV = Nd4j.readNumpy(makeResourcePath("/numpy_cheatsheet/file.csv"), ",");
print("Read from csv", readFromCSV);
} catch (IOException e) {
代码示例来源:origin: org.nd4j/nd4j-api
/**
* Read line via input streams
*
* @param filePath the input stream ndarray
* @return the read txt method
*/
public static INDArray readNumpy(String filePath) throws IOException {
return readNumpy(filePath, "\t");
}
代码示例来源:origin: org.nd4j/nd4j-api
/**
* Read line via input streams
*
* @param filePath the input stream ndarray
* @param split the split separator
* @return the read txt method
*/
public static INDArray readNumpy(String filePath, String split) throws IOException {
return readNumpy(new FileInputStream(filePath), split);
}
代码示例来源:origin: sjsdfg/dl4j-tutorials
protected static Map<String, INDArray> readPlaceholdersAndPredictions() throws IOException {
String[] toReadList = {"input_a", "input_b", "prediction_a", "prediction_b"};
Map<String, INDArray> arraysFromPython = new HashMap<>();
for (int i = 0; i < toReadList.length; i++) {
String varShapePath = new ClassPathResource(BASE_DIR + "/" + toReadList[i] + ".shape").getFile().getPath();
String varValuePath = new ClassPathResource(BASE_DIR + "/" + toReadList[i] + ".csv").getFile().getPath();
int[] varShape = Nd4j.readNumpy(varShapePath, ",").data().asInt();
float[] varContents = Nd4j.readNumpy(varValuePath).data().asFloat();
arraysFromPython.put(toReadList[i], Nd4j.create(varContents).reshape(varShape));
}
return arraysFromPython;
}
}
内容来源于网络,如有侵权,请联系作者删除!