Skip to content

Tensorflow Generate "ops_to_register.h" Without Graph #67960

Closed
@allogic

Description

@allogic

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

tf.2.16.1

Custom code

No

OS platform and distribution

Windows 11 x64

Mobile device

No response

Python version

3.13

Bazel version

6.5.0

GCC/compiler version

MSVC 19.39.33520 for x64

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

I'm trying to build tensorflow as a static library. When I create the root scope it tells me that I didn't register any operators or kernels. Specifically the "NoOp" is required.

I've read that with the tool "tensorflow/python/tools/print_selective_registration_header" I can generate the missing header file "ops_to_register.h" which registers all operators and kernels when I build the C++API again with the flag --cxxopt=”-DSELECTIVE_REGISTRATION”.

But I need a graph definition in order to produce the header file. I don't have a graph since I want to build my model in C++ instead. What can I do to register all operators and kernels. (I don't care about file size!)

Standalone code to reproduce the issue

std::printf(OpRegistry::Global()->DebugString(true).data()); // No output at all...

Scope root = Scope::NewRootScope(); // Crash because "NoOp" is required!

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

TF 2.16comp:opsOPs related issuesstaleThis label marks the issue/pr stale - to be closed automatically if no activitystat:awaiting responseStatus - Awaiting response from authorsubtype:windowsWindows Build/Installation Issuestype:build/installBuild and install issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions