def gen_hdf(fn, lshape, N, mean=None, autoencode=False, multidimout=False):
 (C, H, W) = lshape
 dat = np.arange((((N * C) * H) * W)).reshape((N, ((C * H) * W)))
 h5f = h5py.File(fn, 'w')
 inp = h5f.create_dataset('input', dat.shape)
 inp[:] = dat.copy()
 inp.attrs['lshape'] = (C, H, W)
 if (mean is not None):
  mean_ = h5f.create_dataset('mean', mean.shape)
  mean_[:] = mean
 if (not autoencode):
  if multidimout:
   out = h5f.create_dataset('output', dat.shape)
   out[:] = dat[:, ::(-1)].copy()
  else:
   out = h5f.create_dataset('output', (N, 1), dtype='i8')
   out[:, 0] = np.arange(N)
   out.attrs['nclass'] = N
 h5f.close()
 return

def gen_hdf ( fn , lshape , N , mean = None , autoencode = False , multidimout = False ) : ( C , H , W ) = lshape dat = np . arange ( ( ( ( N * C ) * H ) * W ) ) . reshape ( ( N , ( ( C * H ) * W ) ) ) h5f = h5py . File ( fn , 'w' ) inp = h5f . create_dataset ( 'input' , dat . shape ) inp [ : ] = dat . copy ( ) inp . attrs [ 'lshape' ] = ( C , H , W ) if ( mean is not None ) : mean_ = h5f . create_dataset ( 'mean' , mean . shape ) mean_ [ : ] = mean if ( not autoencode ) : if multidimout : out = h5f . create_dataset ( 'output' , dat . shape ) out [ : ] = dat [ : , : : ( - 1 ) ] . copy ( ) else : out = h5f . create_dataset ( 'output' , ( N , 1 ) , dtype = 'i8' ) out [ : , 0 ] = np . arange ( N ) out . attrs [ 'nclass' ] = N h5f . close ( ) return
generates the hdf file with the data for testing arguments: fn : filename lshape : shape of the input data n : number of data points mean : mean values .