unsigned int i;
size_t ret;
- if (id < 0)
- return false;
-
position =
(uint64_t)((feature_size + num_class) * (uint64_t)id * sizeof(float));
if (position > file_length) {
sharedTensor X = MAKE_SHARED_TENSOR(Tensor({in[i]}));
sharedTensor Y2 = MAKE_SHARED_TENSOR(Tensor({label[i]}));
sharedConstTensor Y = forwarding(X, Y2);
- if (status != ML_ERROR_NONE) {
- ml_loge("Error: forwarding the network resulted in error.");
- return status;
- }
-
if (Y->argmax() == Y2->argmax())
right++;
valloss += getLoss();
: std::shared_ptr<float>(new float[d.getDataLen()],
std::default_delete<float[]>())) {
if (d.getDataLen() == 0) {
- if (buf != nullptr) {
- throw std::runtime_error(
- "Tensor dimension and source buffer size mismatch");
- }
return;
}
}
unsigned int TensorDim::getTensorDim(unsigned int idx) {
- if (idx < 0 || idx > MAXDIM)
+ if (idx > MAXDIM)
throw std::invalid_argument(
"[TensorDim] Tensor Dimension index should be between 0 and 4");
}
void TensorDim::setTensorDim(unsigned int idx, unsigned int value) {
- if (idx < 0 || idx > MAXDIM)
+ if (idx > MAXDIM)
throw std::out_of_range(
"[TensorDim] Tensor Dimension index should be between 0 and 4");
if (value <= 0)
F.clear();
F.seekg(0, std::ios_base::end);
uint64_t file_length = F.tellg();
- if (id < 0)
- return false;
+
uint64_t position =
(uint64_t)((feature_size + num_class) * (uint64_t)id * sizeof(float));