这篇教程C++ CHECK_LE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CHECK_LE函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_LE函数的具体用法?C++ CHECK_LE怎么用?C++ CHECK_LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CHECK_LE函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LegacyShape inline int LegacyShape(int index) const { CHECK_LE(num_axes(), 4) << "Cannot use legacy accessors on Blobs with > 4 axes."; CHECK_LT(index, 4); CHECK_GE(index, -4); if (index >= num_axes() || index < -num_axes()) { // Axis is out of range, but still in [0, 3] (or [-4, -1] for reverse // indexing) -- this special case simulates the one-padding used to fill // extraneous axes of legacy blobs. return 1; } return shape(index); }
开发者ID:jy9387,项目名称:mycaffe,代码行数:13,
示例2: offset inline int offset(const vector<int>& indices) const { CHECK_LE(indices.size(), num_axes()); int offset = 0; for (int i = 0; i < num_axes(); ++i) { offset *= shape(i); if (indices.size() > i) { CHECK_GE(indices[i], 0); CHECK_LT(indices[i], shape(i)); offset += indices[i]; } } return offset; }
开发者ID:jy9387,项目名称:mycaffe,代码行数:13,
示例3: CHECK_GEvoid ThriftServer::CumulativeFailureInjection::set( const FailureInjection& fi) { CHECK_GE(fi.errorFraction, 0); CHECK_GE(fi.dropFraction, 0); CHECK_GE(fi.disconnectFraction, 0); CHECK_LE(fi.errorFraction + fi.dropFraction + fi.disconnectFraction, 1); std::lock_guard<std::mutex> lock(mutex_); errorThreshold_ = fi.errorFraction; dropThreshold_ = errorThreshold_ + fi.dropFraction; disconnectThreshold_ = dropThreshold_ + fi.disconnectFraction; empty_.store((disconnectThreshold_ == 0), std::memory_order_relaxed);}
开发者ID:UIKit0,项目名称:fbthrift,代码行数:13,
示例4: CheckBlobCounts /** * Called by the parent Layer's SetUp to check that the number of bottom * and top Blobs provided as input match the expected numbers specified by * the {ExactNum,Min,Max}{Bottom,Top}Blobs() functions. */ virtual void CheckBlobCounts(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { if (ExactNumBottomBlobs() >= 0) { CHECK_EQ(ExactNumBottomBlobs(), bottom.size()) << type() << " Layer takes " << ExactNumBottomBlobs() << " bottom blob(s) as input."; } if (MinBottomBlobs() >= 0) { CHECK_LE(MinBottomBlobs(), bottom.size()) << type() << " Layer takes at least " << MinBottomBlobs() << " bottom blob(s) as input."; } if (MaxBottomBlobs() >= 0) { CHECK_GE(MaxBottomBlobs(), bottom.size()) << type() << " Layer takes at most " << MaxBottomBlobs() << " bottom blob(s) as input."; } if (ExactNumTopBlobs() >= 0) { CHECK_EQ(ExactNumTopBlobs(), top.size()) << type() << " Layer produces " << ExactNumTopBlobs() << " top blob(s) as output."; } if (MinTopBlobs() >= 0) { CHECK_LE(MinTopBlobs(), top.size()) << type() << " Layer produces at least " << MinTopBlobs() << " top blob(s) as output."; } if (MaxTopBlobs() >= 0) { CHECK_GE(MaxTopBlobs(), top.size()) << type() << " Layer produces at most " << MaxTopBlobs() << " top blob(s) as output."; } if (EqualNumBottomTopBlobs()) { CHECK_EQ(bottom.size(), top.size()) << type() << " Layer produces one top blob as output for each " << "bottom blob input."; } }
开发者ID:csuhawk,项目名称:caffe,代码行数:43,
示例5: TEST TEST(Logging, CheckOpPass) { int i1 = 1; int i2 = 2; unsigned u1 = 3; unsigned u2 = 4; float f1 = 5.5f; float f2 = 6.6f; int* p1 = &i1; int* p2 = &i2; char const * message = "message"; CHECK_EQ(i1, i1) << message; CHECK_EQ(u1, u1) << message; CHECK_EQ(f1, f1) << message; CHECK_EQ(p1, p1) << message; CHECK_NE(i1, i2) << message; CHECK_NE(u1, u2) << message; CHECK_NE(f1, f2) << message; CHECK_NE(p1, p2) << message; CHECK_LT(i1, i2) << message; CHECK_LT(u1, u2) << message; CHECK_LT(f1, f2) << message; CHECK_LE(i1, i1) << message; CHECK_LE(u1, u2) << message; CHECK_LE(f1, f1) << message; CHECK_GT(i2, i1) << message; CHECK_GT(u2, u1) << message; CHECK_GT(f2, f1) << message; CHECK_GE(i1, i1) << message; CHECK_GE(u2, u1) << message; CHECK_GE(f1, f1) << message; }
开发者ID:BitFunnel,项目名称:BitFunnel,代码行数:38,
示例6: CHECK_EQvoid EltwiseAccuracyLayer<Dtype>::Reshape( const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { CHECK_EQ(bottom[0]->num(), bottom[1]->num()) << "The data and label should have the same number."; CHECK_LE(top_k_, bottom[0]->count() / bottom[0]->num()) << "top_k must be less than or equal to the number of classes."; CHECK_EQ(bottom[1]->channels(), 1) << "Label data should have channel 1."; CHECK_EQ(bottom[0]->height(), bottom[1]->height()) << "The data and label should have the same height."; CHECK_EQ(bottom[0]->width(), bottom[1]->width()) << "the data and label should have the same width."; top[0]->Reshape(1, 1, 1, 1);}
开发者ID:573671712,项目名称:caffe-1,代码行数:14,
示例7: CHECK_LEbool CoverageSet::covers(size_t begin, size_t end) const noexcept { CHECK_LE(begin, end) << "End of interval must be greater than or equal to begin"; if (begin == end) { return true; } auto right = set_.upper_bound(Interval{begin, end}); if (right == set_.begin()) { return false; } auto left = std::prev(right); return left->begin <= begin && end <= left->end;}
开发者ID:facebookexperimental,项目名称:eden,代码行数:14,
示例8: CHECK_LEvoid Blob<Dtype>::Reshape(const vector<int>& shape) { CHECK_LE(shape.size(), kMaxBlobAxes); count_ = 1; shape_.resize(shape.size()); if (!shape_data_ || shape_data_->size() < shape.size() * sizeof(int)) { shape_data_.reset(new SyncedMemory(shape.size() * sizeof(int))); } int* shape_data = static_cast<int*>(shape_data_->mutable_cpu_data()); for (int i = 0; i < shape.size(); ++i) { CHECK_GE(shape[i], 0); if (count_ != 0) { CHECK_LE(shape[i], INT_MAX / count_) << "blob size exceeds INT_MAX"; } count_ *= shape[i]; shape_[i] = shape[i]; shape_data[i] = shape[i]; } if (count_ > capacity_) { capacity_ = count_; data_.reset(new SyncedMemory(capacity_ * sizeof(Dtype))); diff_.reset(new SyncedMemory(capacity_ * sizeof(Dtype))); }}
开发者ID:ArtHacker123,项目名称:mini-caffe,代码行数:23,
示例9: sourcestd::unique_ptr<IOBuf> SnappyCodec::doCompress(const IOBuf* data) { IOBufSnappySource source(data); auto out = IOBuf::create(snappy::MaxCompressedLength(source.Available())); snappy::UncheckedByteArraySink sink(reinterpret_cast<char*>( out->writableTail())); size_t n = snappy::Compress(&source, &sink); CHECK_LE(n, out->capacity()); out->append(n); return out;}
开发者ID:1Hgm,项目名称:folly,代码行数:14,
示例10: read_async// Asynchronous read on a overlapped int_fd. Returns `Error` on fatal errors,// `None()` on a successful pending IO operation or number of bytes read on a// successful IO operation that finished immediately.inline Result<size_t> read_async( const int_fd& fd, void* data, size_t size, OVERLAPPED* overlapped){ CHECK_LE(size, UINT_MAX); switch (fd.type()) { case WindowsFD::Type::HANDLE: { DWORD bytes; const bool success = ::ReadFile(fd, data, static_cast<DWORD>(size), &bytes, overlapped); // On failure, there are two EOF cases for reads: // 1) ERROR_BROKEN_PIPE: The write end is closed and there is no data. // 2) ERROR_HANDLE_EOF: We hit the EOF for an asynchronous file handle. const DWORD errorCode = ::GetLastError(); if (success == FALSE && (errorCode == ERROR_BROKEN_PIPE || errorCode == ERROR_HANDLE_EOF)) { return 0; } return ::internal::windows::process_async_io_result(success, bytes); } case WindowsFD::Type::SOCKET: { static_assert( std::is_same<OVERLAPPED, WSAOVERLAPPED>::value, "Expected `WSAOVERLAPPED` to be of type `OVERLAPPED`."); // Note that it's okay to allocate this on the stack, since the WinSock // providers must copy the WSABUF to their internal buffers. See // https://msdn.microsoft.com/en-us/library/windows/desktop/ms741688(v=vs.85).aspx // NOLINT(whitespace/line_length) WSABUF buf = { static_cast<u_long>(size), static_cast<char*>(data) }; DWORD bytes; DWORD flags = 0; const int result = ::WSARecv(fd, &buf, 1, &bytes, &flags, overlapped, nullptr); return ::internal::windows::process_async_io_result(result == 0, bytes); } } UNREACHABLE();}
开发者ID:GrovoLearning,项目名称:mesos,代码行数:52,
示例11: CHECK_GEvoid ArgMaxLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) { out_max_val_ = this->layer_param_.argmax_param().out_max_val(); top_k_ = this->layer_param_.argmax_param().top_k(); CHECK_GE(top_k_, 1) << " top k must not be less than 1."; CHECK_LE(top_k_, bottom[0]->count() / bottom[0]->num()) << "top_k must be less than or equal to the number of classes."; if (out_max_val_) { // Produces max_ind and max_val (*top)[0]->Reshape(bottom[0]->num(), 2, top_k_, 1); } else { // Produces only max_ind (*top)[0]->Reshape(bottom[0]->num(), 1, top_k_, 1); }}
开发者ID:Amos-zq,项目名称:caffe-windows-cudnn,代码行数:15,
示例12: CHECK_LEVector ЧебышёвSeries<Vector>::Evaluate(Instant const& t) const { // This formula ensures continuity at the edges by producing -1 or +1 within // 2 ulps for |t_min_| and |t_max_|. double const scaled_t = ((t - t_max_) + (t - t_min_)) * one_over_duration_; // We have to allow |scaled_t| to go slightly out of [-1, 1] because of // computation errors. But if it goes too far, something is broken. // TODO(phl): This should use DCHECK but these macros don't work because the // Principia projects don't define NDEBUG.#ifdef _DEBUG CHECK_LE(scaled_t, 1.1); CHECK_GE(scaled_t, -1.1);#endif return helper_.EvaluateImplementation(scaled_t);}
开发者ID:pleroy,项目名称:Principia,代码行数:15,
示例13: CHECK_LEvoid Blob<Dtype>::Reshape(const vector<int>& shape) { CHECK_LE(shape.size(), kMaxBlobAxes); count_ = 1; shape_.resize(shape.size()); for (int i = 0; i < shape.size(); ++i) { CHECK_GE(shape[i], 0); count_ *= shape[i]; shape_[i] = shape[i]; } if (count_ > capacity_) { capacity_ = count_; data_.reset(new SyncedMemory(capacity_ * sizeof(Dtype))); diff_.reset(new SyncedMemory(capacity_ * sizeof(Dtype))); }}
开发者ID:gaoyongwyl,项目名称:VmmrAuxLinux,代码行数:15,
示例14: CHECK_LEvoid SegAccuracyLayer<Dtype>::Reshape( const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { CHECK_LE(1, bottom[0]->channels()) << "top_k must be less than or equal to the number of channels (classes)."; CHECK_EQ(bottom[0]->num(), bottom[1]->num()) << "The data and label should have the same number."; CHECK_EQ(bottom[1]->channels(), 1) << "The label should have one channel."; CHECK_EQ(bottom[0]->height(), bottom[1]->height()) << "The data should have the same height as label."; CHECK_EQ(bottom[0]->width(), bottom[1]->width()) << "The data should have the same width as label."; top[0]->Reshape(1, 1, 1, 5);}
开发者ID:xygorn,项目名称:caffe,代码行数:15,
示例15: BleApiTest_TestEncodingLongDataExactLengthReturnValue BleApiTest_TestEncodingLongDataExactLength(pBleDevice dev){ ReturnValue retval; U2F_AUTHENTICATE_REQ authReq; unsigned char reply[2048]; unsigned int replyLength = sizeof(reply); unsigned char request[256]; unsigned int requestlen; unsigned char replyCmd; // pick random challenge and use registered appId. for (size_t i = 0; i < sizeof(authReq.nonce); ++i) authReq.nonce[i] = rand(); memcpy(authReq.appId, regReq.appId, sizeof(authReq.appId)); authReq.keyHandleLen = regRsp.keyHandleLen; memcpy(authReq.keyHandle, regRsp.keyHandleCertSig, authReq.keyHandleLen); uint64_t t = dev->TimeMs(); /* prepare register request */ request[0] = 0x00; request[1] = U2F_INS_AUTHENTICATE; request[2] = U2F_AUTH_ENFORCE; request[3] = 0x00; request[4] = 0x00; request[5] = 0x00; request[6] = U2F_NONCE_SIZE + U2F_APPID_SIZE + 1 + authReq.keyHandleLen; memcpy(request + 7, reinterpret_cast < char *>(&authReq), request[6]); requestlen = 7 + request[6]; request[requestlen++] = 0x00; /* 1 byte user presence + 4 bytes counter + upto (6 + 33 + 33) bytes signature */ request[requestlen++] = 0x01 + 0x04 + 0x48; /* write command */ retval = dev->CommandWrite(FIDO_BLE_CMD_MSG, request, requestlen, &replyCmd, reply, &replyLength); CHECK_EQ(retval, ReturnValue::BLEAPI_ERROR_SUCCESS); CHECK_EQ(replyCmd, FIDO_BLE_CMD_MSG, "Reply is not a FIDO_BLE_CMD_MSG (0x83)"); CHECK_EQ(FIDO_RESP_SUCCESS, bytes2short(reply, replyLength - 2), "expects FIDO_RESP_SUCCESS (0x9000)"); CHECK_NE(replyLength, 2); CHECK_LE(replyLength - 2, sizeof(U2F_AUTHENTICATE_RESP), "Returned authentication response does not match expected length."); return ReturnValue::BLEAPI_ERROR_SUCCESS;}
开发者ID:fido-alliance,项目名称:jovasco-u2f-ref-code,代码行数:48,
示例16: CHECK_LEvoid AccuracyLayer<Dtype>::Reshape( const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { CHECK_LE(top_k_, bottom[0]->count() / bottom[1]->count()) << "top_k must be less than or equal to the number of classes."; label_axis_ = bottom[0]->CanonicalAxisIndex(this->layer_param_.accuracy_param().axis()); outer_num_ = bottom[0]->count(0, label_axis_); inner_num_ = bottom[0]->count(label_axis_ + 1); CHECK_EQ(outer_num_ * inner_num_, bottom[1]->count()) << "Number of labels must match number of predictions; " << "e.g., if label axis == 1 and prediction shape is (N, C, H, W), " << "label count (number of labels) must be N*H*W, " << "with integer values in {0, 1, ..., C-1}."; vector<int> top_shape(0); // Accuracy is a scalar; 0 axes. top[0]->Reshape(top_shape);}
开发者ID:caomw,项目名称:caffe_mpi,代码行数:16,
示例17: DebugStringinline std::string DebugString(double const number, int const precision) { char result[50];#if OS_WIN && PRINCIPIA_COMPILER_MSVC && (_MSC_VER < 1900) unsigned int old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT); int const size = sprintf_s(result, ("%+." + std::to_string(precision) + "e").c_str(), number); _set_output_format(old_exponent_format);#else int const size = snprintf(result, sizeof(result), ("%+." + std::to_string(precision) + "e").c_str(), number);#endif CHECK_LE(0, size); return std::string(result, size);}
开发者ID:fordream,项目名称:Principia,代码行数:16,
示例18: caffe_rng_bernoullivoid caffe_rng_bernoulli(const int n, const Dtype p, unsigned int* r) { CHECK_GE(n, 0); CHECK(r); CHECK_GE(p, 0); CHECK_LE(p, 1);#ifdef USE_MKL bernoulli_generate(n, p, reinterpret_cast<int *>(r));#else boost::bernoulli_distribution<Dtype> random_distribution(p); boost::variate_generator<caffe::rng_t*, boost::bernoulli_distribution<Dtype> > variate_generator(caffe_rng(), random_distribution); for (int i = 0; i < n; ++i) { r[i] = static_cast<unsigned int>(variate_generator()); }#endif}
开发者ID:crobertob,项目名称:caffe,代码行数:16,
示例19: calc real calc(int64_t num) { // We assume that num never decreases. CHECK_LE(lastNum_, num); lastNum_ = num; while (currentSegment_ < rates_.size()) { if (num <= segments_[currentSegment_]) { return learningRate_ * rates_[currentSegment_]; } ++currentSegment_; if (currentSegment_ < rates_.size()) { LOG(INFO) << " learning_rate changes to " << learningRate_ * rates_[currentSegment_]; } } return learningRate_ * rates_.back(); }
开发者ID:absorbguo,项目名称:Paddle,代码行数:16,
示例20: LOG/// Input format: from_v_id /t to_v_idvoid MMSBModel::ReadData() { //TODO /// training data const string& train_data_path = Context::get_string("train_data"); LOG(INFO) << "Read train data from " << train_data_path; fstream train_data_file(train_data_path.c_str(), ios::in); CHECK(train_data_file.is_open()) << "Fail to open " << train_data_path; // header: #v #e Count num_vertices = 0; train_data_file >> num_vertices; LOG(INFO) << "#Vertices/t" << num_vertices; CHECK_LE(train_batch_size_, num_vertices); vertices_.resize(num_vertices); for (VIndex i = 0; i < num_vertices; ++i) { vertices_[i] = new Vertex(); } // links VIndex i, j; while (train_data_file >> i >> j) { if (i != j) { // avoid self-loop vertices_[i]->AddLink(j); vertices_[j]->AddLink(i); } } train_data_file.close(); /// test data const string& test_data_path = Context::get_string("test_data"); LOG(INFO) << "Read test data from " << test_data_path; fstream test_data_file(test_data_path.c_str(), ios::in); CHECK(test_data_file.is_open()) << "Fail to open " << test_data_path; int value = 0; WIndex i_worker, j_worker; while (test_data_file >> i >> j >> value >> i_worker >> j_worker) {#ifdef DEBUG CHECK(vertices_.find(i) != vertices_.end()); CHECK_EQ(i_worker, worker_id_);#endif test_links_.push_back(make_pair(i, j)); test_link_values_.push_back(value); if (j_worker != worker_id_) { test_neighbor_worker_[j] = j_worker; } } LOG(INFO) << "#Test links (pos and neg links)/t" << test_links_.size(); test_data_file.close();}
开发者ID:ZhitingHu,项目名称:network_mp,代码行数:48,
|