X Tutup
The Wayback Machine - https://web.archive.org/web/20200915110542/https://github.com/SciSharp/TensorFlow.NET/issues/607
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

Tensors created with new operator don't have a Device defined and are unusable. #607

Open
vpenades opened this issue Aug 31, 2020 · 2 comments
Open

Comments

@vpenades
Copy link
Contributor

@vpenades vpenades commented Aug 31, 2020

If I create a tensor like this:

tf.convert_to_tensor( new int[] { 1 } );

The tensor works correctly. In contrast, if I create it like this:

new Tensor( new int[] { 1 } , new long[] {1} , TF_DataType.TF_INT32 );

The Device property is NULL and the tensor is unusable. specially when I try to perform some operations with it, for example, tf.Image.resize_bilinear throws the null exception if I use a tensor created with new operator.

So please, if tensors can be created with new operator, ensure they can work correctly.

If that's not possible, and the correct way of creating tensors is with convert_to_tensor, then you should make all the tensors contructors internal, because having them public misleads developers into thinking they can create tensors in that way.

As a suggestion, I would add this test line here;

Assert.NotNull( t.Device );
@Oceania2018
Copy link
Member

@Oceania2018 Oceania2018 commented Aug 31, 2020

@vpenades It would be great if you can PR your unit test even it will fail.

@vpenades
Copy link
Contributor Author

@vpenades vpenades commented Aug 31, 2020

@Oceania2018 I've created a PR that showcases my use case, which I think it's quite common. I have no idea what would be needed to fix it.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup