use of org.tensorflow.Tensor in project zoltar by spotify.
the class TensorFlowGraphModelTest method testDummyLoadOfTensorFlowGraphWithPrefix.
@Test
public void testDummyLoadOfTensorFlowGraphWithPrefix() throws Exception {
final String prefix = "test";
final Path graphFile = createADummyTFGraph();
try (final TensorFlowGraphModel model = TensorFlowGraphModel.create(graphFile.toUri(), null, prefix);
final Session session = model.instance();
final Tensor<Double> double3 = Tensors.create(3.0D)) {
List<Tensor<?>> result = null;
try {
result = session.runner().fetch(prefix + "/" + mulResult).feed(prefix + "/" + inputOpName, double3).run();
assertEquals(result.get(0).doubleValue(), 6.0D, Double.MIN_VALUE);
} finally {
if (result != null) {
result.forEach(Tensor::close);
}
}
}
}
Aggregations