I'm looking to randomly build (without loop) a square tensor (e.g. shape=(N,N)) with the following properties:
- The tensor can only contain 0 and 1 values;
- The number of 1 is fixed for each line and is the same for each line (P the number of 1 for each line with P < N);
- The elements of the diagonal is necessarily a 0.
Can you help me?
Thank you
Romain
Aucun commentaire:
Enregistrer un commentaire