TensorFlow r1.6にて、[NVIDIAのTensorRTがサポートなったようだ。
テストは、こんな感じ。
TEST(TensorrtTest, BasicFunctions) { // Create the network model. nvinfer1::IHostMemory* model = CreateNetwork(); // Use the model to create an engine and then an execution context. Logger logger; nvinfer1::IRuntime* runtime = nvinfer1::createInferRuntime(logger); nvinfer1::ICudaEngine* engine = runtime->deserializeCudaEngine(model->data(), model->size(), nullptr); model->destroy(); nvinfer1::IExecutionContext* context = engine->createExecutionContext(); // Execute the network. float input = 1234; float output; Execute(*context, &input, &output); EXPECT_EQ(output, input * 2 + 3); // Destroy the engine. context->destroy(); engine->destroy(); runtime->destroy(); }
でもね。
TensorFlow r1.7では、一気に増えました。
Using TensorRT in TensorFlow This module provides necessary bindings and introduces TRT_engine_op operator that wraps a subgraph in TensorRT. This is still a work in progress but should be useable with most common graphs.
TensorRT 3.0.4をサポート。