コード例 #1
0
CPNLBase *
CPersistCondSoftMaxDistribFun::Load(CContextLoad *pContext)
{
    int nNode;
    bool bFactor;
    bool isUnitFun;
    CCondSoftMaxDistribFun *pDF;
    const CNodeType *const* ppNodeType;

    LoadForDistribFun(&isUnitFun, &nNode, &ppNodeType, pContext);

    pContext->GetAttribute(&nNode, "NumberOfNodes");
    pContext->GetAttribute(&bFactor, "IsFactor");
    
    CMatrix<CSoftMaxDistribFun*> *mat = static_cast<CMatrix<CSoftMaxDistribFun*>*>(
        pContext->Get("DistributionMatrix"));

    pDF = CCondSoftMaxDistribFun::Create(nNode, ppNodeType);

    CMatrixIterator<CSoftMaxDistribFun*> *it = mat->InitIterator();
    intVector index;

    for(; mat->IsValueHere(it); mat->Next(it))
    {
        mat->Index(it, &index);
        pDF->SetDistribFun(*mat->Value(it), &index.front());
    }

    delete it;

    return pDF;
}