Closed meAloex closed 8 months ago
@Wanglongzhi2001 Could you please take a look at this issue? It seems the codes are equivalent.
@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
@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 tf.boolean_mask
in TensorFlow.NET, this test can not be passed, and it will throw the same wrong message with yours. And I will fix it.
https://github.com/SciSharp/TensorFlow.NET/blob/079b9a334be2a81c511c6148cd2788f165bc7a6d/test/TensorFlowNET.Graph.UnitTest/Basics/TensorTest.cs#L63-L72
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