/* static */ bool CTC::ComputeCTCTargets(const GenericVector<int>& labels, int null_char, const GENERIC_2D_ARRAY<float>& outputs, NetworkIO* targets) { std::unique_ptr<CTC> ctc(new CTC(labels, null_char, outputs)); if (!ctc->ComputeLabelLimits()) { return false; // Not enough time. } // Generate simple targets purely from the truth labels by spreading them // evenly over time. GENERIC_2D_ARRAY<float> simple_targets; ctc->ComputeSimpleTargets(&simple_targets); // Add the simple targets as a starter bias to the network outputs. float bias_fraction = ctc->CalculateBiasFraction(); simple_targets *= bias_fraction; ctc->outputs_ += simple_targets; NormalizeProbs(&ctc->outputs_); // Run regular CTC on the biased outputs. // Run forward and backward GENERIC_2D_ARRAY<double> log_alphas, log_betas; ctc->Forward(&log_alphas); ctc->Backward(&log_betas); // Normalize and come out of log space with a clipped softmax over time. log_alphas += log_betas; ctc->NormalizeSequence(&log_alphas); ctc->LabelsToClasses(log_alphas, targets); NormalizeProbs(targets); return true; }
void TDSPPsk::InitSymbols() { Double_t pi2 = 2*TMath::Pi(); for(Int_t i=0;i<fNumSymbols;++i) { // Book the PSK-Symbols // Double_t t=i*pi2; t/=fNumSymbols; Double_t cosine = TMath::Cos(t); Double_t sine = TMath::Sin(t); // not nice if (TMath::Abs(cosine)<1.e-15) cosine=0; if ( TMath::Abs(sine)<1.e-15) sine=0; fSymbols[i] = TComplex(cosine,sine); // Flat props for Generation // fProbs[i] = 1; // Init the Sigmas for Detection fDetectSigmas[i] = 1; } NormalizeProbs(); }