Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tensorflow] Wrapping tensorflow/core/graph/graph_constructor.h #165

Closed
pcmoritz opened this issue Feb 25, 2016 · 2 comments
Closed

[Tensorflow] Wrapping tensorflow/core/graph/graph_constructor.h #165

pcmoritz opened this issue Feb 25, 2016 · 2 comments

Comments

@pcmoritz
Copy link
Contributor

Thanks a lot for your help so far!

To make modifying existing TensorFlow graphs in Java possible we'd like to wrap

extern Status ConvertGraphDefToGraph(const GraphConstructorOptions& opts,
                                     const GraphDef& gdef, Graph* g);

Unfortunately for this to work I think we also need

std::function<bool(const Node*)> cse_consider_function = nullptr;

from the structs in the same file. I tried

.put(new Info("std::function<bool(const Node*)>").pointerTypes("NodePtrFunc").define())

and then

    public static class NodePtrFunc extends FunctionPointer {
        static { Loader.load(); }
        /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}.\                                                                          
         */
        public    NodePtrFunc(Pointer p) { super(p); }
        protected NodePtrFunc() { allocate(); }
        private native void allocate();
        public native @Cast("bool") boolean call(Pointer ptr);
    }

Unfortunately this doesn't seem to work, the Parser seems to have problems with the const (it seems to contract const Node* to constNode*). Any idea how to fix this?

Best,
Philipp.

saudet added a commit that referenced this issue Feb 27, 2016
saudet added a commit to bytedeco/javacpp that referenced this issue Feb 27, 2016
@saudet
Copy link
Member

saudet commented Feb 27, 2016

I've fixed the issue with the const, but that's not enough. I've made those members "write only". We can't convert std::function to a function object or a function pointer like JavaCPP uses right now... Anyway, the consider function looks like a setting for users, right? So, should be OK the way I've put it.

@saudet
Copy link
Member

saudet commented May 19, 2016

This has been included in the release of version 1.2, so I'm guessing that the above restrictions are satisfactory. Let me know if they are not though, thanks!

@saudet saudet closed this as completed May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants