neurosim / DNN_NeuroSim_V2.1

Benchmark framework of compute-in-memory based accelerators for deep neural network (on-chip training chip focused)
98 stars 48 forks source link

It seems the Input data is not all written to file #13

Closed Shirosakirukia closed 1 year ago

Shirosakirukia commented 1 year ago

As below shows, only the input_matrix[0, :] is changed into filled_matrix_bin and then saved into csv file, so it means not all data in input_matrix can be saved into file? And the silulator cann't read the whole input data, which lead to the wrong result.


def write_matrix_activation_conv(input_matrix,fill_dimension,length,filename):
    filled_matrix_b = np.zeros([input_matrix.shape[2],input_matrix.shape[1]*length],dtype=np.str)
    filled_matrix_bin,scale = dec2bin(input_matrix[0,:],length)
    for i,b in enumerate(filled_matrix_bin):
        filled_matrix_b[:,i::length] =  b.transpose()
    activity = np.sum(filled_matrix_b.astype(np.float), axis=None)/np.size(filled_matrix_b)
    np.savetxt(filename, filled_matrix_b, delimiter=",",fmt='%s')
    return activity```
The codes come from hook.py. And what does the function dec2bin exactly do, waht does  each parammeter means?