TheHellTower / My-Tensorflow-Needs

You can ignore this repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

My-Tensorflow-Needs

Warning This repository is only for me to keep a few info.

I'm using a Nvidia GPU and I'm a Visual Studio user.

Lib download | 2.10 (Novembre 2022)
Cuda download | 11.8
cuDDN download | 8.6.0 | For Cuda 11.x | download older

Setup VC++ Directories(Include Directories and Library Directories) then Linker Input(tensorflow.lib)

Then everything should be ready.

A really basic test script:

#include <format>
#include <iostream>
#include <tensorflow/c/c_api.h>

using namespace std;

TF_Status* status;
TF_SessionOptions* options;
TF_Graph* graph;
TF_Session* session;

#pragma region initAndCleanup
void init() {
    status = TF_NewStatus();
    options = TF_NewSessionOptions();
    graph = TF_NewGraph();
    session = TF_NewSession(graph, options, status);
}

void cleanup() {
    TF_CloseSession(session, status);
    TF_DeleteSession(session, status);
    TF_DeleteSessionOptions(options);
    TF_DeleteGraph(graph);
    TF_DeleteStatus(status);
}
#pragma endregion

int main() {
    std::cout << format("Tensorflow Version: {0}\n\nIf no error or missing thing appear you can continue.\n", TF_Version());
    system("pause & cls");
    // Initialize the TensorFlow library
    
    init();
    
    if (TF_GetCode(status) != TF_OK) {
        std::cerr << format("Failed to initialize TensorFlow: {0}\n", TF_Message(status));
        return 1;
    }
    std::cout << "TensorFlow initialized successfully" << std::endl;

    // Use the TensorFlow session...
    // ...

    // Clean up the TensorFlow session
    cleanup();

    system("pause");

    return 0;
}

About

You can ignore this repo