Error in sparse matrix

sir i m getting an error in fit method of ann may be its about sparse matrix how to remove this plz check it once

Hey @Ashu1318, by convention, indices should be sorted in row-major order (or equivalently
lexicographic order on the tuples indices[i]). This is not enforced when
SparseTensor objects are constructed, but most ops assume correct ordering. If
the ordering of sparse tensor st is wrong, a fixed version can be obtained by
calling [tf.sparse.reorder(st)].
So, using either tf.sparse.reorder or scipy.sort_indices on the matrices, x_t, x_val, y_t, y_val , before the line of code,

hist=model.fit(x_t,y_t,batch_size=128,epochs=5,validation_data=(x_val,y_val))

will resolve the issue.

I hope this helps ! :slight_smile:
Happy Learning !

sir i have tried both methods but cant get rid of this error,can u plz edit my code and send me link of your updated code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

im using bert transformer for this task and got some error could u plz resolve this here is my code link ->>> https://github.com/0013am/data-science/blob/main/ERR/Movie%20(1).ipynb