Txeo is a lightweight C++ wrapper for TensorFlow, designed to streamline the development process while maintaining high performance and flexibility. With an intuitive API, it simplifies tensor operations and model loading, enabling seamless interaction with TensorFlow's powerful capabilities. Experience near-native performance and a cleaner coding experience with Txeo.
Txeo is a modern C++ wrapper designed to enhance the TensorFlow development experience by providing a lightweight and intuitive API for C++ programmers. Built using modern C++ standards, Txeo simplifies TensorFlow's complexity, enabling developers to focus on building applications without getting mired in the low-level intricacies of TensorFlow's native C++ interface.
Compared to the native TensorFlow C++ API, Txeo has been rigorously benchmarked using a multiclassification convolution model, demonstrating negligible performance overhead ranging from 0.65% to 1.21%.
| Compiler | Txeo (μs) | TensorFlow (μs) | Difference (%) |
|---|---|---|---|
| GCC | 233,994 | 232,494 | +0.65% |
| Intel | 234,489 | 232,683 | +0.78% |
| Clang | 236,858 | 234,016 | +1.21% |
Txeo facilitates quick setup with simple C++ examples. Below are two usage scenarios:
This example showcases how to create, save, and load a tensor:
#include "txeo/Tensor.h"
#include "txeo/TensorIO.h"
#include <iostream>
using namespace txeo;
using namespace std;
int main() {
Tensor<double> tensor({3, 3}, {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0});
TensorIO::write_textfile(tensor, "tensor.txt");
auto loaded_tensor = TensorIO::read_textfile<double>("tensor.txt");
loaded_tensor.reshape({9});
cout << loaded_tensor << endl;
return 0;
}
This example demonstrates loading a model and running inference:
#include "txeo/Predictor.h"
#include "txeo/Tensor.h"
#include "txeo/TensorIO.h"
using namespace txeo;
#include <iostream>
#include <string>
int main() {
string model_path = "path/to/saved_model";
string input_path = "path/to/input_tensor.txt";
string output_path = "path/to/output_tensor.txt";
Predictor<float> predictor{model_path};
auto input = TensorIO::read_textfile<float>(input_path);
auto output = predictor.predict(input);
TensorIO::write_textfile(output, output_path);
return 0;
}
Txeo is continuously evolving, with upcoming features focused on model training and advanced tensor operations, enabling capabilities like backpropagation support, gradient descent with various optimizers, and richer tensor manipulation techniques.
Equipped with user-friendly documentation and extensive examples, Txeo caters to both newcomers and seasoned developers looking to harness the power of TensorFlow through a modern C++ interface. For more information, visit the Txeo documentation at txeo site.
Txeo stands as a practical solution for developers aiming for efficiency and simplicity in C++ TensorFlow programming while maintaining robust performance.
No comments yet.
Sign in to be the first to comment.