There are few things missing in your explanation. The fully connected layer here mean a tensordot operation on the last dimension of the input.
Just set samples to 1 and run the code again. it won’t give you identical results.