Giter VIP home page Giter VIP logo

Comments (32)

evelynoliv avatar evelynoliv commented on May 25, 2024 1

Hi there,

I am facing missing external symbols when trying to compile both new projects or the examples:

These are the 3 first erros from 53 total:

Erro	LNK2019	símbolo externo não resolvido, __imp_TF_DataTypeSize, referenciado na função "public: class std::vector<__int64,class std::allocator<__int64> > __cdecl cppflow::tensor::get_data<__int64>(void)const " (??$get_data@_J@tensor@cppflow@@QEBA?AV?$vector@_JV?$allocator@_J@std@@@std@@XZ)	mySketch2	C:\Users\Superuber\Desktop\of_v20230321_vs_release\apps\myApps\mySketch2\ofxTensorFlow2Utils.obj	1	
Erro	LNK2019	símbolo externo não resolvido, __imp_TF_NewStatus, referenciado na função "public: static struct TF_Status * __cdecl cppflow::context::get_status(void)" (?get_status@context@cppflow@@SAPEAUTF_Status@@XZ)	mySketch2	C:\Users\Superuber\Desktop\of_v20230321_vs_release\apps\myApps\mySketch2\ofxTensorFlow2Utils.obj	1	
Erro	LNK2001	símbolo externo não resolvido __imp_TF_NewStatus	mySketch2	

I checked the VS Project configuration, and it seems to be missing the libs folder. I tried to add it manually without success.

I also noticed that Project Generator is presenting a error message when trying to import the examples.
image

Could you please help?

from ofxtensorflow2.

paul-ferragut avatar paul-ferragut commented on May 25, 2024

I didn't manage to compile the examples with Visual Studio 64bits
First I was missing files from https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.4.0.zip ; tensorflow/c/c_api_macros.h, tensorflow/c/tf_tstring.h, tensorflow/core/platform/ctstring.h, tensorflow/core/platform/ctstring_internal.h
After adding those files, I get errors in cppflow/model.h "op_idx", "op_name" undeclared identifier.
Then, I tried to comment the part with the undeclared identifier and got cannot include file "sys/errno.h" in ofxTensorFlow2Utils.cpp

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

Did you install libtensorflow with the download script? If not, the required layout is basically:

libs/tensorflow/
libs/tensorflow//LICENSE
libs/tensorflow//include
libs/tensorflow//include/tensorflow
libs/tensorflow//include/tensorflow/core
libs/tensorflow//include/tensorflow/core/platform
libs/tensorflow//include/tensorflow/core/platform/ctstring.h
libs/tensorflow//include/tensorflow/core/platform/ctstring_internal.h
libs/tensorflow//include/tensorflow/c
libs/tensorflow//include/tensorflow/c/c_api_experimental.h
libs/tensorflow//include/tensorflow/c/c_api.h
libs/tensorflow//include/tensorflow/c/tf_status.h
libs/tensorflow//include/tensorflow/c/tf_attrtype.h
libs/tensorflow//include/tensorflow/c/tf_datatype.h
libs/tensorflow//include/tensorflow/c/tf_file_statistics.h
libs/tensorflow//include/tensorflow/c/c_api_macros.h
libs/tensorflow//include/tensorflow/c/tf_tensor.h
libs/tensorflow//include/tensorflow/c/tensor_interface.h
libs/tensorflow//include/tensorflow/c/tf_tstring.h
libs/tensorflow//include/tensorflow/c/eager
libs/tensorflow//include/tensorflow/c/eager/c_api_experimental.h
libs/tensorflow//include/tensorflow/c/eager/dlpack.h
libs/tensorflow//include/tensorflow/c/eager/c_api.h
libs/tensorflow//THIRD_PARTY_TF_C_LICENSES
libs/tensorflow//.gitkeep
libs/tensorflow//lib

with the libraries in lib going into:

libs/tensorflow//lib/vs

As for sys/errno.h, yes comment that out and also comment the setLogLevel stuff in ofxTensorFlow2Utils.h & ofxTensorFlow2Utils.cpp.

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

After adding those files, I get errors in cppflow/model.h "op_idx", "op_name" undeclared identifier.

Also, can you confirm the cppflow sources are in libs/cppflow? If the folder is empty, you need to init and update the submodule.

from ofxtensorflow2.

paul-ferragut avatar paul-ferragut commented on May 25, 2024

Did you install libtensorflow with the download script? If not, the required layout is basically:

libs/tensorflow/
libs/tensorflow//LICENSE
libs/tensorflow//include
libs/tensorflow//include/tensorflow
libs/tensorflow//include/tensorflow/core
libs/tensorflow//include/tensorflow/core/platform
libs/tensorflow//include/tensorflow/core/platform/ctstring.h
libs/tensorflow//include/tensorflow/core/platform/ctstring_internal.h
libs/tensorflow//include/tensorflow/c
libs/tensorflow//include/tensorflow/c/c_api_experimental.h
libs/tensorflow//include/tensorflow/c/c_api.h
libs/tensorflow//include/tensorflow/c/tf_status.h
libs/tensorflow//include/tensorflow/c/tf_attrtype.h
libs/tensorflow//include/tensorflow/c/tf_datatype.h
libs/tensorflow//include/tensorflow/c/tf_file_statistics.h
libs/tensorflow//include/tensorflow/c/c_api_macros.h
libs/tensorflow//include/tensorflow/c/tf_tensor.h
libs/tensorflow//include/tensorflow/c/tensor_interface.h
libs/tensorflow//include/tensorflow/c/tf_tstring.h
libs/tensorflow//include/tensorflow/c/eager
libs/tensorflow//include/tensorflow/c/eager/c_api_experimental.h
libs/tensorflow//include/tensorflow/c/eager/dlpack.h
libs/tensorflow//include/tensorflow/c/eager/c_api.h
libs/tensorflow//THIRD_PARTY_TF_C_LICENSES
libs/tensorflow//.gitkeep
libs/tensorflow//lib

with the libraries in lib going into:

libs/tensorflow//lib/vs

As for sys/errno.h, yes comment that out and also comment the setLogLevel stuff in ofxTensorFlow2Utils.h & ofxTensorFlow2Utils.cpp.

  • I tried to use the download scripts but it wasn't working, I don't know if it something wrong with my configuration. So I have added the files missing manually with the layout. Now the errors in cppflow/model.h "op_idx", "op_name" undeclared identifier disappeared :)

  • sys/errno.h commented out worked without other complications

  • I had an issue with

#ifdef TARGET_WIN32
/// Windows doesn't provide setenv(), use this _putenv_s() wrapper from:
/// https://stackoverflow.com/a/23616164/2146055
static setenv(const char *name, const char *value, int overwrite) {

changed it to: int setenv(const char *name, const char *value, int overwrite) {
and it worked.

  • I have the library in the folder libs/tensorflow//lib/vs as shown in your layout

  • Now it seems I have one last issue;

Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "public: class std::vector<class cppflow::tensor,class std::allocator > __cdecl cppflow::model::operator()(class std::vector<class std::tuple<class std::basic_string<char,struct std::char_traits,class std::allocator >,class cppflow::tensor>,class std::allocator<class std::tuple<class std::basic_string<char,struct std::char_traits,class std::allocator >,class cppflow::tensor> > >,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > >)" (??Rmodel@cppflow@@qeaa?AV?$vector@Vtensor@cppflow@@v?$allocator@Vtensor@cppflow@@@std@@@std@@v?$vector@V?$tuple@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@Vtensor@cppflow@@@std@@v?$allocator@V?$tuple@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@Vtensor@cppflow@@@std@@@2@@3@V?$vector@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@v?$allocator@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@2@@3@@z) example_basics C:\Users\Paul\Documents\Coding\of_v0.11.0_vs2017_release\of_v0.11.0_vs2017_release\addons\ofxTensorFlow2\example_basics\ofxTF2Model.obj 1

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

I tried to use the download scripts but it wasn't working, I don't know if it something wrong with my configuration.

They require a Unix shell, so they would work in Msys as long as curl and unzip are installed. I'm not sure, but maybe they would work in Powershell?

If you have any time later, send any script errors our way too. :)

Now it seems I have one last issue;

That looks like some sort of issue with cppflow templating. Since cppflow is built into the project, then maybe something that was declared in one of the ofxTensorFlow2 src files but the implementation is not found. I would think that we would have seen this on other platforms too, though...

UPDATE: Another option is a bug with cppflow. Since I assume you checked out the submodule, it's the correct commit form cppflow upstream. This is important right now as the TF2 support for cppflow is in a branch right now.

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

The sys/errno.h and setenv errors should be fixed in the latest commit.

from ofxtensorflow2.

paul-ferragut avatar paul-ferragut commented on May 25, 2024

the error with the script is
"tar.exe: Error opening archive: Unrecognized archive format"
if changed .tar.gz to .zip in the sh script it downloads but with a few missing files

I tried to start over and get cppflow using git submodule update --init --recursive
getting again errors undeclared identifiers 'op_name', 'op_idx' in model.h

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

if changed .tar.gz to .zip in the sh script it downloads but with a few missing files

Ah ok, that makes sense. They give the Windows download as a zip as most users wouldn't have tar available by default.

Hrmmm strange. As you noted, the Windows zips have fewer headers. Maybe they are not up to date? @bytosaur what do you think?

libtensorflow-cpu-windows-x86_64-2.4.0
libtensorflow-cpu-windows-x86_64-2.4.0/LICENSE
libtensorflow-cpu-windows-x86_64-2.4.0/include
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/c_api.h
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/tf_status.h
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/tf_attrtype.h
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/tf_datatype.h
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/tf_tensor.h
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/eager
libtensorflow-cpu-windows-x86_64-2.4.0/include/tensorflow/c/eager/c_api.h
libtensorflow-cpu-windows-x86_64-2.4.0/THIRD_PARTY_TF_C_LICENSES
libtensorflow-cpu-windows-x86_64-2.4.0/lib
libtensorflow-cpu-windows-x86_64-2.4.0/lib/tensorflow.dll
libtensorflow-cpu-windows-x86_64-2.4.0/lib/tensorflow.lib

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

Latest commit has fix for script zip file handling.

Also, I noticed that the Nightly Builds mentioned on the TF C download page don't have Windows builds.

from ofxtensorflow2.

paul-ferragut avatar paul-ferragut commented on May 25, 2024

The tensorflow download script is working now.
Currently I tried to copy the missing headers from the linux tensorflow library and commented out this part in cppflow/model.h

		/*
    for (int i=0; i<inputs.size(); i++) {

            // Operations
            const auto[op_name, op_idx] = parse_name(std::get<0>(inputs[i]));
            inp_ops[i].oper = TF_GraphOperationByName(this->graph.get(), op_name.c_str());
            inp_ops[i].index = op_idx;

            if (!inp_ops[i].oper)
                throw std::runtime_error("No operation named \"" + op_name + "\" exists");

            // Values
            inp_val[i] = std::get<1>(inputs[i]).get_tensor().get();
        }
		*/
		
        std::vector<TF_Output> out_ops(outputs.size());
        auto out_val = std::make_unique<TF_Tensor*[]>(outputs.size());
		/*
        for (int i=0; i<outputs.size(); i++) {

            const auto[op_name, op_idx] = parse_name(outputs[i]);
            out_ops[i].oper = TF_GraphOperationByName(this->graph.get(), op_name.c_str());
            out_ops[i].index = op_idx;

            if (!out_ops[i].oper)
                throw std::runtime_error("No operation named \"" + op_name + "\" exists");

        }
		*/

I am not sure what this part of code is doing?

This time the example compiled until the end but throwing an exception on launch 'tensorflow.pdb not loaded"
In the console:

2021-02-14 12:41:56.466284: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-14 12:41:56.489900: I tensorflow/cc/saved_model/reader.cc:32] Reading SavedModel from: data\model
2021-02-14 12:41:56.491334: I tensorflow/cc/saved_model/reader.cc:55] Reading meta graph with tags { serve }
2021-02-14 12:41:56.491412: I tensorflow/cc/saved_model/reader.cc:93] Reading SavedModel debug info (if present) from: data\model
2021-02-14 12:41:56.504371: I tensorflow/cc/saved_model/loader.cc:206] Restoring SavedModel bundle.
2021-02-14 12:41:56.521362: I tensorflow/cc/saved_model/loader.cc:190] Running initialization op on SavedModel bundle at path: data\model
2021-02-14 12:41:56.524460: I tensorflow/cc/saved_model/loader.cc:277] SavedModel load for tags { serve }; Status: success: OK. Took 34542 microseconds.

C:\Users\Paul\Documents\Coding\of_v0.11.0_vs2017_release\of_v0.11.0_vs2017_release\addons\ofxTensorFlow2\example_basics\bin\example_basics.exe (process 30340) exited with code -1.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

This time the example compiled until the end but throwing an exception on launch 'tensorflow.pdb not loaded"

I think that's an optional file used for debugging, judging from this. I imagine libtensorflow is built for release and doesn't include this.

from ofxtensorflow2.

paul-ferragut avatar paul-ferragut commented on May 25, 2024

Latest commit has fix for script zip file handling.

Also, I noticed that the Nightly Builds mentioned on the TF C download page don't have Windows builds.

tensorflow/tensorflow#46538 hopefully this should be fixed soon

from ofxtensorflow2.

liquidzym avatar liquidzym commented on May 25, 2024

i'm just did complied the lastest dev branch, vs2017& win 10 ,with a bit of change

from ofxtensorflow2.

bytosaur avatar bytosaur commented on May 25, 2024

hey @liquidzym,

that sounds wonderful! Let me know if you have a repo up which I can review and pull from :)

from ofxtensorflow2.

liquidzym avatar liquidzym commented on May 25, 2024

sorry,not yet, but for the ref you can have a look at this

  1. download the windows GPU version https://www.tensorflow.org/install/lang_c
  2. i'm using the default master branch which is https://github.com/serizba/cppflow/
  3. i've have to changed some code since OF not fully support c++ 17 yet, according to this pull requests serizba/cppflow#108
  4. download the lastest cundd 8.2.4 not working with 8.04
  5. that's all it's should be working!

from ofxtensorflow2.

jeffcrouse avatar jeffcrouse commented on May 25, 2024

One other thing that I didn't see here that ended up being the silver bullet for me to get the movenet example running...

Everything was compiling for me, but when I tried to run, I was getting an error saying it was unable to load the cuDNN DLL. After some googling, I found this page, suggesting that there is a very specific combination of TF/CUDA/cuDNN that is recommended.

For me, I had downloaded tensorflow_gpu-2.7.0, so according to that chart, that means I needed CUDA 11.2 and cuDNN 8.1 (note that there are multiple versions of cuDNN 8.1, so make sure to choose the version for CUDA 11.2)

I'll make a PR for the README once I get a little further along in this project.

from ofxtensorflow2.

danzeeeman avatar danzeeeman commented on May 25, 2024

running into weird errors with this and windows 10

from ofxtensorflow2.

jeffcrouse avatar jeffcrouse commented on May 25, 2024

Hey Dan -- I'm actively using my fork with Windows. It's not polished up yet, but it works. https://github.com/jeffcrouse/ofxTensorFlow2

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

@jeffcrouse Care to make a PR, including any required info added to the readme?

from ofxtensorflow2.

danzeeeman avatar danzeeeman commented on May 25, 2024

@jeffcrouse I'm able to build this repo with openFrameworks main branch (thanks for the recommendations theo), I had to update cuDNN to a newer version but it still won't run completely.

from ofxtensorflow2.

danzeeeman avatar danzeeeman commented on May 25, 2024

finally got it all working with this repo CUDA 11.4 and cuDNN for 11.4 and openFrameworks main branch with cpp17 support

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

If things are working, we would be happy to take a PR on this. Let us know what to add to the readme, if you don't care to edit it yourselves.

from ofxtensorflow2.

jeffcrouse avatar jeffcrouse commented on May 25, 2024

I’m definitely going to do that once I get through this production. Maybe earlier. Thanks for the great add on!

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

I’m definitely going to do that once I get through this production. Maybe earlier. Thanks for the great add on!

Understood. Thanks

from ofxtensorflow2.

Jonathhhan avatar Jonathhhan commented on May 25, 2024

I got it working with VS and the original branch. All I had to change was ofxTensorFlow2\libs\tensorflow\lib\msys to ofxTensorFlow2\libs\tensorflow\lib\vs.
I put the files from C:\Program Files\NVIDIA GPU Computing Toolkit\CUDNN\v8.4.1.50\bin and zlibwapi.dll into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin.
I use Tensorflow 2.9 gpu (installed with the included script), CUDA 11.7 and CUDNN 8.4.1.50.

from ofxtensorflow2.

bytosaur avatar bytosaur commented on May 25, 2024

hey @Jonathhhan,
cool, thanks for the advice! I ll look into it ;)

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

from ofxtensorflow2.

bytosaur avatar bytosaur commented on May 25, 2024

hey @Jonathhhan,
I am sorry I dont have the resources for reproducing your approach. Anyhow, as danomatika said, PRs are very welcome.

from ofxtensorflow2.

Jonathhhan avatar Jonathhhan commented on May 25, 2024

@bytosaur I made a PR: #20

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

I've added the steps from @Jonathhhan and the tested build config link from @jeffcrouse to a new widows section in the readme: https://github.com/zkmkarlsruhe/ofxTensorFlow2#windows

Please review this and let me know if there is anything to add/change. I'd like to release a new version of the addon soon.

from ofxtensorflow2.

danomatika avatar danomatika commented on May 25, 2024

I've added the steps from @Jonathhhan and the tested build config link from @jeffcrouse to a new widows section in the readme: https://github.com/zkmkarlsruhe/ofxTensorFlow2#windows

Please review this and let me know if there is anything to add/change. I'd like to release a new version of the addon soon.

Ah well, I released 1.4.0 now anyway. :) We can always fix the readme in 1.4.1.

from ofxtensorflow2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.