Commit d7b77519 authored by Andrey Filippov's avatar Andrey Filippov

Merge branch 'gpu' of git@git.elphel.com:Elphel/imagej-elphel.git into gpu

parents f04bcc82 33bdb384
...@@ -146,19 +146,23 @@ public class TensorflowExamplePlugin ...@@ -146,19 +146,23 @@ public class TensorflowExamplePlugin
System.out.println("S1:"); System.out.println("S1:");
//opr = bundle.graph().operation("rv_stageY_out");
//System.out.println(opr.toString());
// init variable via constant? // init variable via constant?
Tensor<Float> tsr = toTensor2DFloat(rv_stage1_out, tensorsToClose); //Tensor<Float> tsr = toTensor2DFloat(rv_stage1_out, tensorsToClose);
/*
Output builder_init = bundle.graph() Output builder_init = bundle.graph()
.opBuilder("Const", "rv_stage1_out_init") .opBuilder("Const", "rv_stage1_out_init")
.setAttr ("dtype", tsr.dataType()) .setAttr ("dtype", tsr.dataType())
.setAttr ("value", tsr) .setAttr ("value", tsr)
.build() .build()
.output(0); .output(0);
*/
System.out.println(builder_init); //System.out.println(builder_init);
// variable // variable
OperationBuilder builder2 = bundle.graph().opBuilder("Variable", "rv_stage1_out_extra_variable"); //OperationBuilder builder2 = bundle.graph().opBuilder("Variable", "rv_stage1_out_extra_variable");
//.addInput(builder_init); //.addInput(builder_init);
//builder2. //builder2.
...@@ -170,7 +174,11 @@ public class TensorflowExamplePlugin ...@@ -170,7 +174,11 @@ public class TensorflowExamplePlugin
//Output oValue = bundle.graph().opBuilder("Variable", "rv_stage1_out").setAttr("value", tensorVal).build().output(0); //Output oValue = bundle.graph().opBuilder("Variable", "rv_stage1_out").setAttr("value", tensorVal).build().output(0);
//bundle.graph().opBuilder("Assign", "Assign/rv_stage1_out").setAttr("value", tsr).build(); //bundle.graph().opBuilder("Assign", "Assign/rv_stage1_out").setAttr("value", tsr).build();
System.out.println("DONE"); System.out.println("Stage 0.1");
//bundle.session().runner().fetch("rv_stageY_out").run();
System.out.println("Stage 0.2");
bundle.session().runner().fetch("rv_stage1_out").run();
System.out.println("Stage 1");
// stage 1 // stage 1
bundle.session().runner() bundle.session().runner()
...@@ -181,17 +189,23 @@ public class TensorflowExamplePlugin ...@@ -181,17 +189,23 @@ public class TensorflowExamplePlugin
.run() .run()
.get(0); .get(0);
System.out.println("Stage 1 DONE");
System.out.println("Stage 2");
// stage 2 // stage 2
final Tensor<?> result = bundle.session().runner() final Tensor<?> result = bundle.session().runner()
.feed("ph_ntile",toTensor1DInt(img_ntile, tensorsToClose)) .feed("ph_ntile_out",toTensor1DInt(img_ntile, tensorsToClose))
.fetch("Disparity_net/stage2_out_sparse:0") .fetch("Disparity_net/stage2_out_sparse:0")
.run() .run()
.get(0); .get(0);
tensorsToClose.add(result); System.out.println("Stage 2 DONE: "+result.shape());
float [] resultValues = (float[]) result.copyTo(new float[78408]); tensorsToClose.add(result);
System.out.println("Copy result to variable");
float [][] resultValues = (float[][]) result.copyTo(new float[78408][1]);
System.out.println("DONE"); System.out.println("DONE");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment