|
@@ -101,13 +101,6 @@ public class TensorflowModel {
|
|
* @return 模型的输出
|
|
* @return 模型的输出
|
|
*/
|
|
*/
|
|
private float[][] run(float[] inputValues, Map<String, int[]> sequenceValues, int numExamples) {
|
|
private float[][] run(float[] inputValues, Map<String, int[]> sequenceValues, int numExamples) {
|
|
-
|
|
|
|
-
|
|
|
|
- long[] inputShape = {numExamples, this.NUM_FEATURE};
|
|
|
|
- Tensor<Float> inputTensor = Tensor.create(
|
|
|
|
- inputShape,
|
|
|
|
- FloatBuffer.wrap(inputValues)
|
|
|
|
- );
|
|
|
|
float[][] f = new float[numExamples][NUM_LABEL];
|
|
float[][] f = new float[numExamples][NUM_LABEL];
|
|
for (int i = 0; i < numExamples; i++) {
|
|
for (int i = 0; i < numExamples; i++) {
|
|
for (int j = 0; j < NUM_LABEL; j++) {
|
|
for (int j = 0; j < NUM_LABEL; j++) {
|
|
@@ -115,6 +108,13 @@ public class TensorflowModel {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return f;
|
|
return f;
|
|
|
|
+
|
|
|
|
+// long[] inputShape = {numExamples, this.NUM_FEATURE};
|
|
|
|
+// Tensor<Float> inputTensor = Tensor.create(
|
|
|
|
+// inputShape,
|
|
|
|
+// FloatBuffer.wrap(inputValues)
|
|
|
|
+// );
|
|
|
|
+
|
|
// // 序列数据
|
|
// // 序列数据
|
|
// if (this.withSequenceInputs){
|
|
// if (this.withSequenceInputs){
|
|
// Map<String, Tensor<Integer>> sequenceTensorMap = this.wrapSequenceInputs(sequenceValues, numExamples);
|
|
// Map<String, Tensor<Integer>> sequenceTensorMap = this.wrapSequenceInputs(sequenceValues, numExamples);
|