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

Merge operation accepts only single input #345

Open
SamKG opened this issue Jan 14, 2022 · 5 comments
Open

Merge operation accepts only single input #345

SamKG opened this issue Jan 14, 2022 · 5 comments
Labels

Comments

@SamKG
Copy link

SamKG commented Jan 14, 2022

The Merge operation (https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/merge) should accept a list of inputs, and output the first received tensor.
However, the rust binding (https://tensorflow.github.io/rust/tensorflow/ops/fn.merge.html) currently accepts only a single input (despite the input variable being named "inputs"). Digging through the source code, I found that Merge.build_impl internally also calls nd.add_input instead of nd.add_inputs (https://tensorflow.github.io/rust/src/tensorflow/ops/ops_impl.rs.html#57909)

Is there a way to pass multiple inputs using this api?

@dskkato
Copy link
Contributor

dskkato commented Jan 15, 2022

ref #325

@adamcrume
Copy link
Contributor

It looks like the problem is that we're ignoring number_attr on input_arg. This is an issue for any op that takes a list as an input.

@adamcrume adamcrume added the bug label Apr 24, 2022
@SamKG
Copy link
Author

SamKG commented Apr 24, 2022

@adamcrume
I'd be happy to take a stab at fixing this - any pointers on where to start? Is it as simple as using the add_inputs method I mentioned earlier?

@adamcrume
Copy link
Contributor

This wouldn't be quite that straightforward. The code for the ops is generated by tensorflow-op-codegen/src/main.rs, and I think the fix is to change write_short_fn, write_build_fn, and write_build_impl_fn so that they use a slice of Outputs rather than a single Output for any input_arg where number_attr is set. Then the ops would need to be regenerated by running cargo run -- $PATH_TO_TENSORFLOW $PWD/.. from the tensorflow-op-codegen folder.

@Corallus-Caninus
Copy link
Contributor

Corallus-Caninus commented Oct 26, 2022

Does the below build_instance method close this?

https://tensorflow.github.io/rust/tensorflow/ops/struct.Merge.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants