HI.
I tried to train my model with “tf.RaggedTensor.from_value_rowids” in a custom loss function.
I met an error log as follows.
Node: ‘custom_loss/while_1/RaggedFromValueRowIds/RowPartitionFromValueRowIds/assert_less/Assert/Assert’
assertion failed: [Arguments to from_value_rowids do not form a valid RowPartition] [Condition x < y did not hold element-wise:] [x (custom_loss/while_1/RaggedFromValueRowIds/RowPartitionFromValueRowIds/strided_slice_3:0) = ] [1073741824] [y (custom_loss/while_1/RaggedFromValueRowIds/RowPartitionFromValueRowIds/nrows:0) = ] [32896]
[[{{node custom_loss/while_1/RaggedFromValueRowIds/RowPartitionFromValueRowIds/assert_less/Assert/Assert}}]] [Op:__inference_train_function_100219]
The shapes for input/output of my custom loss function are
- [None, 5760, 3]
- [None, 32896, 2]
cf. “Custom size” depends on the input data size.
cf. The output tensor could be highly sparse, which means including many 0(zeros)
tensorflow 2.12.0
python 3.8.16
-
I cannot understand this error log, because the custom loss function works well outside training, meaning I executed the custom loss function standalone. It works well.
-
I have no idea about the number “1073741824” in the error log “[x (custom_loss/while_1/RaggedFromValueRowIds/RowPartitionFromValueRowIds/strided_slice_3:0) = ] [1073741824]”. The number was not changed with different input sizes from [None, 5760, 3] to [None, any other size, 3]
-
The error occurs after the custom loss function. That is a sub-definition in loss definition. When I checked every line in the custom loss function, it occurred after the statement “return loss”
Thanks~