-
Notifications
You must be signed in to change notification settings - Fork 536
[Question]: Shape must be rank 1 but is rank 0 #1203
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
Comments
@Wanglongzhi2001 Could you please take a look at this issue? It seems the codes are equivalent. |
Certainly. |
@Wanglongzhi2001 This python project uses tensorflow.compat.v1. I don't know how important it is, it seems like they are the same, but just in case |
I'm sorry, it looks like there exists some problem with the implementation of the TensorFlow.NET/test/TensorFlowNET.Graph.UnitTest/Basics/TensorTest.cs Lines 63 to 72 in 079b9a3
|
Hello, I have fixed this bug in #1205 . But for now, please use this API in eager mode. |
Description
Problem with the boolean_mask() method. Here is the error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> Tensorflow.InvalidArgumentError: Shape must be rank 1 but is rank 0 for '{{node boolean_mask/concat}} = ConcatV2[N=3, T=DT_INT32, Tidx=DT_INT32](boolean_mask/strided_slice_1, boolean_mask/Prod, boolean_mask/strided_slice_2, boolean_mask/concat/axis)' with input shapes: [0], [], [1], [].
The code I'm trying to migrate from python to c#:
`
`
The input receives:
feature_unit_all_feature_2 = Tensor("all_shared_part/feature_unit_global_tran_2/Relu:0", shape=(?, 100), dtype=float32)
Rank of feature_unit_all_feature_2: 2
unit_categoy_batch = Tensor("all_shared_part/Reshape:0", shape=(?, 1), dtype=int32)
type_constant = 4
My c# code:
My logs:
input shape (None, 100) input rank 2
feature_bool_mask shape (None,) feature_bool_mask rank 1
I roughly understand what my problem is, but I don't know how to solve it correctly. I didn't have any errors in python with the same passed values. Did I understand correctly that due to the fact that I have a Tensor of rank 2, not 1. Yes, the error signals the presence of a Tensor of rank 0, but I don't seem to have such.
l will appreciate any help!
Alternatives
No response
The text was updated successfully, but these errors were encountered: