diff --git a/src/caffe/test/test_data/generate_sample_data.py b/src/caffe/test/test_data/generate_sample_data.py index 3703b41823b..8349dbbc8e6 100644 --- a/src/caffe/test/test_data/generate_sample_data.py +++ b/src/caffe/test/test_data/generate_sample_data.py @@ -36,23 +36,25 @@ f['label'] = label f['label2'] = label2 -with h5py.File(script_dir + '/sample_data_2_gzip.h5', 'w') as f: +with h5py.File(script_dir + '/sample_data_uint8_gzip.h5', 'w') as f: f.create_dataset( 'data', data=data + total_size, compression='gzip', compression_opts=1 ) f.create_dataset( 'label', data=label, - compression='gzip', compression_opts=1 + compression='gzip', compression_opts=1, + dtype='uint8', ) f.create_dataset( 'label2', data=label2, - compression='gzip', compression_opts=1 + compression='gzip', compression_opts=1, + dtype='uint8', ) with open(script_dir + '/sample_data_list.txt', 'w') as f: - f.write(script_dir + '/sample_data.h5\n') - f.write(script_dir + '/sample_data_2_gzip.h5\n') + f.write('src/caffe/test/test_data/sample_data.h5\n') + f.write('src/caffe/test/test_data/sample_uint8_gzip.h5\n') # Generate GradientBasedSolver solver_data.h5 @@ -76,4 +78,4 @@ f['targets'] = targets with open(script_dir + '/solver_data_list.txt', 'w') as f: - f.write(script_dir + '/solver_data.h5\n') + f.write('src/caffe/test/test_data/solver_data.h5\n') diff --git a/src/caffe/test/test_data/sample_data_2_gzip.h5 b/src/caffe/test/test_data/sample_data_2_gzip.h5 index a138e0367be..0cb9ef92241 100644 Binary files a/src/caffe/test/test_data/sample_data_2_gzip.h5 and b/src/caffe/test/test_data/sample_data_2_gzip.h5 differ diff --git a/src/caffe/util/hdf5.cpp b/src/caffe/util/hdf5.cpp index d0d05f70f8f..7730e76ab87 100644 --- a/src/caffe/util/hdf5.cpp +++ b/src/caffe/util/hdf5.cpp @@ -27,7 +27,34 @@ void hdf5_load_nd_dataset_helper( status = H5LTget_dataset_info( file_id, dataset_name_, dims.data(), &class_, NULL); CHECK_GE(status, 0) << "Failed to get dataset info for " << dataset_name_; - CHECK_EQ(class_, H5T_FLOAT) << "Expected float or double data"; + switch (class_) { + case H5T_FLOAT: + LOG_FIRST_N(INFO, 1) << "Datatype class: H5T_FLOAT"; + break; + case H5T_INTEGER: + LOG_FIRST_N(INFO, 1) << "Datatype class: H5T_INTEGER"; + break; + case H5T_TIME: + LOG(FATAL) << "Unsupported datatype class: H5T_TIME"; + case H5T_STRING: + LOG(FATAL) << "Unsupported datatype class: H5T_STRING"; + case H5T_BITFIELD: + LOG(FATAL) << "Unsupported datatype class: H5T_BITFIELD"; + case H5T_OPAQUE: + LOG(FATAL) << "Unsupported datatype class: H5T_OPAQUE"; + case H5T_COMPOUND: + LOG(FATAL) << "Unsupported datatype class: H5T_COMPOUND"; + case H5T_REFERENCE: + LOG(FATAL) << "Unsupported datatype class: H5T_REFERENCE"; + case H5T_ENUM: + LOG(FATAL) << "Unsupported datatype class: H5T_ENUM"; + case H5T_VLEN: + LOG(FATAL) << "Unsupported datatype class: H5T_VLEN"; + case H5T_ARRAY: + LOG(FATAL) << "Unsupported datatype class: H5T_ARRAY"; + default: + LOG(FATAL) << "Datatype class unknown"; + } vector blob_dims(dims.size()); for (int i = 0; i < dims.size(); ++i) {