TEST_P(Test_Torch_layers, net_inception_block) { runTorchNet("net_inception_block", GetParam(), "", false, true); }
void SetUp() override { auto tup = GetParam(); uncompressedLength_ = uint64_t(1) << std::tr1::get<0>(tup); codec_ = getCodec(std::tr1::get<1>(tup)); }
ATKAutoSwell::ATKAutoSwell(IPlugInstanceInfo instanceInfo) : IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo), inFilter(nullptr, 1, 0, false), outFilter(nullptr, 1, 0, false), gainSwellFilter(1, 256*1024) { TRACE; //arguments are: name, defaultVal, minVal, maxVal, step, label GetParam(kPower)->InitDouble("Power", 10., 0., 100.0, 0.1, "ms"); GetParam(kPower)->SetShape(2.); GetParam(kAttack)->InitDouble("Attack", 10., 1., 100.0, 0.1, "ms"); GetParam(kAttack)->SetShape(2.); GetParam(kRelease)->InitDouble("Release", 10, 1., 100.0, 0.1, "ms"); GetParam(kRelease)->SetShape(2.); GetParam(kThreshold)->InitDouble("Threshold", 0., -40., 0.0, 0.1, "dB"); // threshold is actually power GetParam(kSlope)->InitDouble("Slope", 2., 1.5, 100, .1, "-"); GetParam(kSlope)->SetShape(2.); GetParam(kSoftness)->InitDouble("Softness", -2, -4, 0, 0.1, "-"); GetParam(kSoftness)->SetShape(2.); GetParam(kMakeup)->InitDouble("Makeup Gain", 0, 0, 40, 0.1, "dB"); // Makeup is expressed in amplitude GetParam(kDryWet)->InitDouble("Dry/Wet", 1, 0, 1, 0.01, "-"); IGraphics* pGraphics = MakeGraphics(this, kWidth, kHeight); pGraphics->AttachBackground(COLORED_COMPRESSOR_ID, COLORED_COMPRESSOR_FN); IBitmap knob = pGraphics->LoadIBitmap(KNOB_ID, KNOB_FN, kKnobFrames); IBitmap knob1 = pGraphics->LoadIBitmap(KNOB1_ID, KNOB1_FN, kKnobFrames1); IColor color = IColor(255, 255, 255, 255); IText text = IText(10, &color, nullptr, IText::kStyleBold); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kPowerX, kPowerY, kPowerX + 78, kPowerY + 78 + 21), kPower, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kAttackX, kAttackY, kAttackX + 78, kAttackY + 78 + 21), kAttack, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kReleaseX, kReleaseY, kReleaseX + 78, kReleaseY + 78 + 21), kRelease, &knob, &text, "ms")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kThresholdX, kThresholdY, kThresholdX + 78, kThresholdY + 78 + 21), kThreshold, &knob, &text, "dB")); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kSlopeX, kSlopeY, kSlopeX + 78, kSlopeY + 78 + 21), kSlope, &knob, &text, "")); pGraphics->AttachControl(new IKnobMultiControl(this, kSoftnessX, kSoftnessY, kSoftness, &knob)); pGraphics->AttachControl(new IKnobMultiControlText(this, IRECT(kMakeupX, kMakeupY, kMakeupX + 78, kMakeupY + 78 + 21), kMakeup, &knob, &text, "dB")); pGraphics->AttachControl(new IKnobMultiControl(this, kDryWetX, kDryWetY, kDryWet, &knob1)); AttachGraphics(pGraphics); //MakePreset("preset 1", ... ); MakePreset("Serial Swell", 10., 10., 10., 0., 2., .1, 0., 1.); MakePreset("Parallel Swell", 10., 10., 10., 0., 2., .1, 0., 0.5); powerFilter.set_input_port(0, &inFilter, 0); attackReleaseFilter.set_input_port(0, &powerFilter, 0); gainSwellFilter.set_input_port(0, &attackReleaseFilter, 0); applyGainFilter.set_input_port(0, &gainSwellFilter, 0); applyGainFilter.set_input_port(1, &inFilter, 0); volumeFilter.set_input_port(0, &applyGainFilter, 0); drywetFilter.set_input_port(0, &volumeFilter, 0); drywetFilter.set_input_port(1, &inFilter, 0); outFilter.set_input_port(0, &drywetFilter, 0); Reset(); }
// Create an std and a bolt vector of requested size, and initialize all the elements to 1 ScanIntegerVector( ): stdInput( GetParam( ), 1 ), boltInput( GetParam( ), 1 ) {}
// Create an std and a bolt vector of requested size, and initialize all the elements to 1 ScanDoubleVector( ): stdInput( GetParam( ), 1.0 ), boltInput( GetParam( ), 1.0 ) {}
RooFitResult * safeFit(RooAbsPdf * pdf, RooDataSet * data, Str2VarMap p, ISVALIDF_PTR isValid, string opt = "", int nfree = -1, RooArgSet * cons = NULL, RooAbsReal * nll = NULL) { RooFitResult * res = NULL; RooRealVar cosThetaL("cosThetaL","cosThetaL",0.,-1.,1.); RooRealVar cosThetaB("cosThetaB","cosThetaB",0.,-1.,1.); RooArgSet obs(cosThetaL,cosThetaB); //if(opt.find("-scan")==string::npos) res = pdf->fitTo(*data,PrintLevel(-1),Save(),Extended(true)); if(p.size()==1 && p.find("afb") != p.end()) p["fL"] = GetParam(pdf,"fL"); else if(p.size()==1 && p.find("fL") != p.end()) p["afb"] = GetParam(pdf,"afb"); RooArgSet * nuisances = NULL; /* bool afb_iscost = false, fL_iscost = false, afbB_iscost = false; if (p.find("afb") != p.end()) { afb_iscost = ((RooRealVar*)p["afb"])->getAttribute("Constant"); ((RooRealVar*)p["afb"])->setConstant(); } if (p.find("fL") != p.end()) { fL_iscost = ((RooRealVar*)p["fL"])->getAttribute("Constant"); ((RooRealVar*)p["fL"])->setConstant(); } if (p.find("afbB") != p.end()) { afbB_iscost = ((RooRealVar*)p["afbB"])->getAttribute("Constant"); ((RooRealVar*)p["afbB"])->setConstant(); } RooArgSet * nuisances = copyFreePars(pdf,obs); if (p.find("afb") != p.end()) ((RooRealVar*)p["afb"])->setConstant(afb_iscost); if (p.find("afbB") != p.end()) ((RooRealVar*)p["afbB"])->setConstant(afbB_iscost); if (p.find("fL") != p.end()) ((RooRealVar*)p["fL"])->setConstant(fL_iscost); */ int np = 20; if((!res || res->covQual()!=3 || res->edm() > 0.1) && opt.find("-noscan")==string::npos) { if(!nll) nll = pdf->createNLL(*data); vector < double > mins, maxs, r; Str2VarMap::iterator iter; int pp = 0; for (iter = p.begin(); iter != p.end(); iter++) { RooRealVar * curp = (RooRealVar *)iter->second; maxs.push_back(curp->getMax()); mins.push_back(curp->getMin()); r.push_back((maxs.back() - mins.back())/(double)np); pp++; } findMin(pdf,data,nll,p,mins,maxs,np,isValid,nfree,opt+"-nofit",cons,nuisances); double prec = 1e6; while (prec > 0.001) { double maxr = 0; maxs.clear(); mins.clear(); pp=0; for (iter = p.begin(); iter != p.end(); iter++) { RooRealVar * curp = (RooRealVar *)iter->second; if((curp->getVal() + r[pp]) < curp->getMax()) maxs.push_back(curp->getVal() + r[pp]); else maxs.push_back(curp->getMax()); if((curp->getVal() - r[pp]) > curp->getMin()) mins.push_back(curp->getVal() - r[pp]); else mins.push_back(curp->getMin()); r[pp] = (maxs.back() - mins.back())/(double)np; if(r[pp] > maxr) maxr = r[pp]; pp++; } prec = maxr; res = findMin(pdf,data,nll,p,mins,maxs,np,isValid,nfree,opt,cons,nuisances); } //if(!mynll) delete nll; } return res; }
TEST_P(Python_test, sofa_python_test) { run(GetParam()); }
TEST_P_EX(LARGE_TEST, Random) { test(randstr(GetParam())); }
void SetUp() { classifier_.reset(new driver::classifier( GetParam(), make_fv_converter())); }
TEST_P(ML_ANN_METHOD, Test) { int methodType = get<0>(GetParam()); string methodName = get<1>(GetParam()); int N = get<2>(GetParam()); String folder = string(cvtest::TS::ptr()->get_data_path()); String original_path = folder + "waveform.data"; String dataname = folder + "waveform" + '_' + methodName; Ptr<TrainData> tdata2 = TrainData::loadFromCSV(original_path, 0); Mat samples = tdata2->getSamples()(Range(0, N), Range::all()); Mat responses(N, 3, CV_32FC1, Scalar(0)); for (int i = 0; i < N; i++) responses.at<float>(i, static_cast<int>(tdata2->getResponses().at<float>(i, 0))) = 1; Ptr<TrainData> tdata = TrainData::create(samples, ml::ROW_SAMPLE, responses); ASSERT_FALSE(tdata.empty()) << "Could not find test data file : " << original_path; RNG& rng = theRNG(); rng.state = 0; tdata->setTrainTestSplitRatio(0.8); Mat testSamples = tdata->getTestSamples(); #ifdef GENERATE_TESTDATA { Ptr<ml::ANN_MLP> xx = ml::ANN_MLP_ANNEAL::create(); Mat_<int> layerSizesXX(1, 4); layerSizesXX(0, 0) = tdata->getNVars(); layerSizesXX(0, 1) = 30; layerSizesXX(0, 2) = 30; layerSizesXX(0, 3) = tdata->getResponses().cols; xx->setLayerSizes(layerSizesXX); xx->setActivationFunction(ml::ANN_MLP::SIGMOID_SYM); xx->setTrainMethod(ml::ANN_MLP::RPROP); xx->setTermCriteria(TermCriteria(TermCriteria::COUNT, 1, 0.01)); xx->train(tdata, ml::ANN_MLP::NO_OUTPUT_SCALE + ml::ANN_MLP::NO_INPUT_SCALE); FileStorage fs; fs.open(dataname + "_init_weight.yml.gz", FileStorage::WRITE + FileStorage::BASE64); xx->write(fs); fs.release(); } #endif { FileStorage fs; fs.open(dataname + "_init_weight.yml.gz", FileStorage::READ); Ptr<ml::ANN_MLP> x = ml::ANN_MLP_ANNEAL::create(); x->read(fs.root()); x->setTrainMethod(methodType); if (methodType == ml::ANN_MLP::ANNEAL) { x->setAnnealEnergyRNG(RNG(CV_BIG_INT(0xffffffff))); x->setAnnealInitialT(12); x->setAnnealFinalT(0.15); x->setAnnealCoolingRatio(0.96); x->setAnnealItePerStep(11); } x->setTermCriteria(TermCriteria(TermCriteria::COUNT, 100, 0.01)); x->train(tdata, ml::ANN_MLP::NO_OUTPUT_SCALE + ml::ANN_MLP::NO_INPUT_SCALE + ml::ANN_MLP::UPDATE_WEIGHTS); ASSERT_TRUE(x->isTrained()) << "Could not train networks with " << methodName; string filename = dataname + ".yml.gz"; Mat r_gold; #ifdef GENERATE_TESTDATA x->save(filename); x->predict(testSamples, r_gold); { FileStorage fs_response(dataname + "_response.yml.gz", FileStorage::WRITE + FileStorage::BASE64); fs_response << "response" << r_gold; } #else { FileStorage fs_response(dataname + "_response.yml.gz", FileStorage::READ); fs_response["response"] >> r_gold; } #endif ASSERT_FALSE(r_gold.empty()); Ptr<ml::ANN_MLP> y = Algorithm::load<ANN_MLP>(filename); ASSERT_TRUE(y != NULL) << "Could not load " << filename; Mat rx, ry; for (int j = 0; j < 4; j++) { rx = x->getWeights(j); ry = y->getWeights(j); double n = cvtest::norm(rx, ry, NORM_INF); EXPECT_LT(n, FLT_EPSILON) << "Weights are not equal for layer: " << j; } x->predict(testSamples, rx); y->predict(testSamples, ry); double n = cvtest::norm(ry, rx, NORM_INF); EXPECT_LT(n, FLT_EPSILON) << "Predict are not equal to result of the saved model"; n = cvtest::norm(r_gold, rx, NORM_INF); EXPECT_LT(n, FLT_EPSILON) << "Predict are not equal to 'gold' response"; } }
TEST_P_EX(SMALL_TEST, Biolerplate) { test(GetParam()); }
TEST_P(MXnbTest, DoesMXWithFullCP) { runTests("modelexpansion.idp", GetParam(), "mxwithfullcp()"); }
TEST_P(Test_Torch_layers, net_non_spatial) { runTorchNet("net_non_spatial", GetParam(), "", false, true); }
TEST_P(Test_Torch_layers, net_normalize) { runTorchNet("net_normalize", GetParam(), "", false, true); }
TEST_P(RemoveWhitespaceTest, testRemoveWhitespace) { RemoveWhitespaceTestData data = GetParam(); EXPECT_EQ(data.expectedOutput, AssistantXmlReader::removeWhiteSpace(data.input)); }
//------------------------------------------------------------------------ bool CHomingMissile::Init(IGameObject *pGameObject) { if(CRocket::Init(pGameObject)) { m_cruiseAltitude = GetParam("cruise_altitude", m_cruiseAltitude); m_accel = GetParam("accel", m_accel); m_turnSpeed = GetParam("turn_speed", m_turnSpeed); m_maxSpeed = GetParam("max_speed", m_maxSpeed); m_alignAltitude = GetParam("align_altitude", m_alignAltitude); m_descendDistance = GetParam("descend_distance", m_descendDistance); m_maxTargetDistance = GetParam("max_target_distance", m_maxTargetDistance); m_cruise = GetParam("cruise", m_cruise); m_controlled = GetParam("controlled", m_controlled); m_autoControlled = GetParam("autoControlled",m_autoControlled); m_lazyness = GetParam("lazyness",m_lazyness); m_lockedTimer = GetParam("initial_delay",m_lockedTimer); m_detonationRadius = GetParam("detonation_radius",m_detonationRadius); return true; } return false; }
WithdrawAccountTest() { account.balance = GetParam().initBalance; }
long L6470::getPos(){ unsigned long position = GetParam(ABS_POS); return convert(position); }
void Filter::Parse(const char *pArg) { BOOL foundOut = FALSE; for (int iOut = 0 ; iOut < sizeof(pinOut_names)/sizeof(pinOut_names[0]) ; iOut++) { const char *pParam; if ((pParam = GetParam(pArg, pinOut_names[iOut].pName)) == NULL) continue; foundOut = TRUE; if ((outMask & pinOut_names[iOut].val) != 0) { cerr << "Duplicated option --" << pinOut_names[iOut].pName << endl; Invalidate(); } outMask |= pinOut_names[iOut].val; BOOL negative; if (*pParam == '!') { negative = TRUE; pParam++; } else { negative = FALSE; } BOOL foundIn = FALSE; _ASSERTE(sizeof(pinIn_names)/sizeof(pinIn_names[0]) == sizeof(pinMap)/sizeof(pinMap[0])); for (int iIn = 0 ; iIn < sizeof(pinIn_names)/sizeof(pinIn_names[0]) ; iIn++) { if (_stricmp(pParam, pinIn_names[iIn].pName) == 0) { foundIn = TRUE; lmInMask |= pinIn_names[iIn].lmVal; pinMap[iIn].mask |= pinOut_names[iOut].val; if (negative) pinMap[iIn].val &= ~pinOut_names[iOut].val; else pinMap[iIn].val |= pinOut_names[iOut].val; break; } } if (!foundIn) { cerr << "Unknown pin " << pParam << endl; Invalidate(); } break; } if (!foundOut) { cerr << "Unknown option " << pArg << endl; Invalidate(); } }
void L6470::init(){ // This is the generic initialization function to set up the Arduino to // communicate with the dSPIN chip. // // set up the input/output pins for the application. // pinMode(10, OUTPUT); // The SPI peripheral REQUIRES the hardware SS pin- // // pin 10- to be an output. This is in here just // // in case some future user makes something other // // than pin 10 the SS pin. pinMode(_SSPin, OUTPUT); digitalWrite(_SSPin, HIGH); // pinMode(MOSI, OUTPUT); // pinMode(MISO, INPUT); // pinMode(SCK, OUTPUT); // pinMode(BUSYN, INPUT); // pinMode(RESET, OUTPUT); // // reset the dSPIN chip. This could also be accomplished by // // calling the "L6470::ResetDev()" function after SPI is initialized. // digitalWrite(RESET, HIGH); // delay(10); // digitalWrite(RESET, LOW); // delay(10); // digitalWrite(RESET, HIGH); // delay(10); // // initialize SPI for the dSPIN chip's needs: // // most significant bit first, // // SPI clock not to exceed 5MHz, // // SPI_MODE3 (clock idle high, latch data on rising edge of clock) // SPI.begin(); // SPI.setBitOrder(MSBFIRST); // SPI.setClockDivider(SPI_CLOCK_DIV16); // or 2, 8, 16, 32, 64 // SPI.setDataMode(SPI_MODE3); // First things first: let's check communications. The CONFIG register should // power up to 0x2E88, so we can use that to check the communications. unsigned long p = 0; while (1) { p = GetParam(CONFIG); Serial.print("STATUS "); Serial.print(_SSPin); Serial.print(" "); if (p == 0x2E88){ Serial.println("OK"); break; }else{ Serial.print("WAIT"); Serial.println(p, HEX); delay(10); // break; } } // First, let's set the step mode register: // - SYNC_EN controls whether the BUSY/SYNC pin reflects the step // frequency or the BUSY status of the chip. We want it to be the BUSY // status. // - STEP_SEL_x is the microstepping rate- we'll go full step. // - SYNC_SEL_x is the ratio of (micro)steps to toggles on the // BUSY/SYNC pin (when that pin is used for SYNC). Make it 1:1, despite // not using that pin. //SetParam(STEP_MODE, !SYNC_EN | STEP_SEL_1 | SYNC_SEL_1); // Set up the CONFIG register as follows: // PWM frequency divisor = 1 // PWM frequency multiplier = 2 (62.5kHz PWM frequency) // Slew rate is 290V/us // Do NOT shut down bridges on overcurrent // Disable motor voltage compensation // Hard stop on switch low // 16MHz internal oscillator, nothing on output SetParam(CONFIG, CONFIG_PWM_DIV_1 | CONFIG_PWM_MUL_2 | CONFIG_SR_290V_us| CONFIG_OC_SD_DISABLE | CONFIG_VS_COMP_DISABLE | CONFIG_SW_HARD_STOP | CONFIG_INT_16MHZ); // Configure the RUN KVAL. This defines the duty cycle of the PWM of the bridges // during running. 0xFF means that they are essentially NOT PWMed during run; this // MAY result in more power being dissipated than you actually need for the task. // Setting this value too low may result in failure to turn. // There are ACC, DEC, and HOLD KVAL registers as well; you may need to play with // those values to get acceptable performance for a given application. SetParam(KVAL_RUN, 0xFF); SetParam(KVAL_ACC, 0xFF); SetParam(KVAL_DEC, 0xFF); SetParam(KVAL_HOLD, 0x80); // Calling GetStatus() clears the UVLO bit in the status register, which is set by // default on power-up. The driver may not run without that bit cleared by this // read operation. getStatus(); hardStop(); //engage motors }
TEST_P(Python_scene_test, sofa_python_scene_tests) { run(GetParam()); }
TEST_CYCLE() cvtColor(src, dst, mode, ch.dcn); SANITY_CHECK(dst, 1); } typedef tuple<Size, CvtMode2> Size_CvtMode2_t; typedef perf::TestBaseWithParam<Size_CvtMode2_t> Size_CvtMode2; PERF_TEST_P(Size_CvtMode2, cvtColorYUV420, testing::Combine( testing::Values(szVGA, sz1080p, Size(130, 60)), CvtMode2::all() ) ) { Size sz = get<0>(GetParam()); int mode = get<1>(GetParam()); ChPair ch = getConversionInfo(mode); Mat src(sz.height + sz.height / 2, sz.width, CV_8UC(ch.scn)); Mat dst(sz, CV_8UC(ch.dcn)); declare.in(src, WARMUP_RNG).out(dst); int runs = (sz.width <= 640) ? 8 : 1; TEST_CYCLE_MULTIRUN(runs) cvtColor(src, dst, mode, ch.dcn); SANITY_CHECK(dst, 1); } typedef tuple<Size, CvtMode3> Size_CvtMode3_t;
// Create an std and a bolt vector of requested size, and initialize all the elements to 1 ScanFloatVector( ): stdInput( GetParam( ), 1.0f ), boltInput( GetParam( ), 1.0f ) {}
TEST_P(VertexLoaderParamTest, PositionAll) { int addr, format, elements, frac; std::tie(addr, format, elements, frac) = GetParam(); this->m_vtx_desc.Position = addr; this->m_vtx_attr.g0.PosFormat = format; this->m_vtx_attr.g0.PosElements = elements; this->m_vtx_attr.g0.PosFrac = frac; this->m_vtx_attr.g0.ByteDequant = true; elements += 2; std::vector<float> values = { std::numeric_limits<float>::lowest(), std::numeric_limits<float>::denorm_min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::max(), std::numeric_limits<float>::quiet_NaN(), std::numeric_limits<float>::infinity(), -0x8000, -0x80, -1, -0, 0, 1, 123, 0x7F, 0xFF, 0x7FFF, 0xFFFF, 12345678, }; ASSERT_EQ(0u, values.size() % 2); ASSERT_EQ(0u, values.size() % 3); int count = (int)values.size() / elements; u32 elem_size = 1 << (format / 2); size_t input_size = elements * elem_size; if (addr & MASK_INDEXED) { input_size = addr - 1; for (int i = 0; i < count; i++) if (addr == INDEX8) Input<u8>(i); else Input<u16>(i); VertexLoaderManager::cached_arraybases[ARRAY_POSITION] = m_src.GetPointer(); g_main_cp_state.array_strides[ARRAY_POSITION] = elements * elem_size; } CreateAndCheckSizes(input_size, elements * sizeof(float)); for (float value : values) { switch (format) { case FORMAT_UBYTE: Input((u8)value); break; case FORMAT_BYTE: Input((s8)value); break; case FORMAT_USHORT: Input((u16)value); break; case FORMAT_SHORT: Input((s16)value); break; case FORMAT_FLOAT: Input(value); break; } } RunVertices(count); float scale = 1.f / (1u << (format == FORMAT_FLOAT ? 0 : frac)); for (auto iter = values.begin(); iter != values.end();) { float f, g; switch (format) { case FORMAT_UBYTE: f = (u8)*iter++; g = (u8)*iter++; break; case FORMAT_BYTE: f = (s8)*iter++; g = (s8)*iter++; break; case FORMAT_USHORT: f = (u16)*iter++; g = (u16)*iter++; break; case FORMAT_SHORT: f = (s16)*iter++; g = (s16)*iter++; break; case FORMAT_FLOAT: f = *iter++; g = *iter++; break; } ExpectOut(f * scale); ExpectOut(g * scale); } }
TEST_P(ConversionMatrixRegression, Inversion) { test_encode_decode(GetParam()); }
TEST_P(TrimLeftTest, testTrimLeft) { TrimLeftTestData data = GetParam(); EXPECT_EQ(data.expectedReturn, AssistantXmlReader::trimLeft(data.input)); EXPECT_EQ(data.expectedOutput, data.input); }
void SetUp() override { codec_ = getCodec(GetParam()); }
TEST_P(TrimRightTest, testTrimRight) { TrimRightTestData data = GetParam(); AssistantXmlReader::trimRight(data.input); EXPECT_EQ(data.expectedOutput, data.input); }
bool ISerializeble::GetParam( const char* name, sint32& target ) { return GetParam( tools::StringToCrc32( name ), target ); }
TEST_P(Test_Torch_layers, net_conv_gemm_lrn) { runTorchNet("net_conv_gemm_lrn", GetParam(), "", false, true); }