thanks @beaupreda for your response
I use in another part of my code
    for i in range(60000):
        label = torch.Tensor([labels[i % len(labels)]]).long()
        image = images[i % len(labels)]

by the way , when i write this print(dataiter.next()) it just shows me two arrays of 28*28 (it means for two images …while we have 60000 training examples in mnist)
Do you think i need to put it in a loop or not needed?
about last line and dividing on 255 , it was my fault that i modified it
the original code is here, if you liked to check it

  
      github.com
  
  
    BINDS-LAB-UMASS/bindsnet_experiments/blob/master/experiments/mnist/backprop.py 5
import os
import torch
import argparse
import numpy as np
import matplotlib.pyplot as plt

from time import time as t
from sklearn.metrics import confusion_matrix

from bindsnet.datasets import MNIST
from bindsnet.network import Network, load_network
from bindsnet.network.monitors import Monitor
from bindsnet.network.topology import Connection
from bindsnet.network.nodes import RealInput, IFNodes
from bindsnet.analysis.plotting import plot_spikes, plot_weights

from experiments import ROOT_DIR

data = 'mnist'
model = 'backprop'


  This file has been truncated. show original