limitations under the License.
@file bitmat_helpers.cpp
@brief bitmap_helpers from tensorflow
+@author TensorFlow Authors
+@bug there are no known bugs
==============================================================================*/
const uint8_t *img_bytes = new uint8_t[len];
file.seekg(0, std::ios::beg);
- file.read((char *)img_bytes, len);
+ file.read((char *)img_bytes, static_cast<std::streamsize>(len));
const int32_t header_size =
*(reinterpret_cast<const int32_t *>(img_bytes + 10));
*width = *(reinterpret_cast<const int32_t *>(img_bytes + 18));
std::vector<Tensor> &labels) {
NNTR_THROW_IF(idx >= sz, std::range_error)
<< "given index is out of bound, index: " << idx << " size: " << sz;
- file.seekg(idx * sample_size * RawFileDataProducer::pixel_size,
- std::ios_base::beg);
+ std::streamoff offset = static_cast<std::streamoff>(
+ idx * sample_size * RawFileDataProducer::pixel_size);
+ file.seekg(offset, std::ios_base::beg);
for (auto &input : inputs) {
input.read(file);
}
// << " Given file does not align with the given sample size, sample size: "
// << sample_size << " file_size: " << file_size;
- return file_size / (sample_size * RawFileDataProducer::pixel_size);
+ return static_cast<unsigned int>(file_size) /
+ (sample_size * RawFileDataProducer::pixel_size);
}
void RawFileDataProducer::exportTo(
const TensorDim &input_dim = context.getInputDimensions()[0];
const unsigned int batch_size = input_dim.batch();
const unsigned int max_timestep = input_dim.height();
+ NNTR_THROW_IF(max_timestep < 1, std::runtime_error)
+ << "max timestep must be greator than 0 in gru layer.";
const unsigned int feature_size = input_dim.width();
// if return_sequences == False :
if (!std::get<props::MaxTimestep>(lstm_props).empty())
max_timestep =
std::max(max_timestep, std::get<props::MaxTimestep>(lstm_props).get());
+ NNTR_THROW_IF(max_timestep < 1, std::runtime_error)
+ << "max timestep must be greator than 0 in lstm layer.";
std::get<props::MaxTimestep>(lstm_props).set(max_timestep);
const unsigned int feature_size = input_dim.width();
const TensorDim &input_dim = context.getInputDimensions()[SINGLE_INOUT_IDX];
const unsigned int batch_size = input_dim.batch();
const unsigned int max_timestep = input_dim.height();
+ NNTR_THROW_IF(max_timestep < 1, std::runtime_error)
+ << "max timestep must be greator than 0 in rnn layer.";
const unsigned int feature_size = input_dim.width();
// output_dim = [ batch, 1, (return_sequences ? time_iteration : 1), unit ]
#ifdef _WIN32
return _fullpath(resolved, name, MAX_PATH_LENGTH);
#else
- return realpath(name, resolved);
+ resolved = realpath(name, nullptr);
+ return resolved;
#endif
}