About Documentation Tutorial
General Usage

A short explanation of the functionality of Flint and how to use it correctly.
Not intended as a Tutorial but rather an introduction which makes you familiar with the concepts used in this library, so that it (hopefully) becomes easier to understand the code and usage of it.


C Headers

The C Header mainly exists for abstracting the implementation from the C++ syntax sugar.
It acts as a common interface for writing high level interfaces, especially to provide an easy interface for other languages.

If you want to write a language interface for Flint or really squeeze that last bit of performance out of it by avoiding the C++ overhead, this is the place to go.
float data1[] = {1,2,3,4};
double data2[] = {4,3,2,1};
double shape[] = {2,2};
FGraphNode *g1 = fCreateGraph(&data1[0], 4, F_FLOAT32, &shape[0]);
FGraphNode *g2 = fCreateGraph(&data2[0], 4, F_FLOAT64, &shape[0]);
g2->reference_counter++;
FGraphNode *mm = fOptimizeMemory(fExecuteGraph(fmatmul(g1, g2))); //also frees g1 but not g2
FResultData *rd = mm->result_data;
double* result = rd->data;
fFreeGraph(mm); // also frees result and rd
fFreeGraph(g2); // does not free g2, because of the reference_counter


C++ Headers

Those headers allow convenient, fast developement directly in C++. It provides class abstractions around the C Interface, with templates binding the types and dimensionality of the Tensors, which provides a strong compile time type check, which helps you to find bugs,before you start your application.

If you want to develop in C++ this is the place to go.
Tensor<float, 2> t1{{1,2}, {3,4}};
Tensor<double, 2> t2{{4,3}, {2,1}};
Tensor<double, 2> mm = t1.matmul(t2);
// access directly (fast)
std::cout << mm[0][1] << std::endl;
std::cout << mm << std::endl;
// or transform to vector (slow)
std::vector<std::vector<double>> res = *mm;


Deep Learning Headers

Implementation of a templated deep learning framework with Flint in C++. Strongly works with templates and concepts to allow flexible usage and good performance.

auto m = SequentialModel{
  Conv2D(1, 10, 7, std::array<unsigned int, 2>{2, 2}, NO_PADDING),
  Relu(),
  Flatten(),
  Connected(1210, 80),
  Relu(),
  Connected(80, 10),
  SoftMax()
};
std::cout << m.summary() << std::endl;