SharedVariableArray (Migrated from community.research.microsoft.com) RRS feed

  • Question

  • freddycct posted on 10-03-2009 11:50 PM

    Hi John, 

    Thanks for your reply

    how do I convert this array here to a SharedVariableArray?

    VariableArray<Vector> phi = Variable.Array<Vector>(topicsNumRange);


    Friday, June 3, 2011 5:19 PM


  • John Guiver replied on 10-05-2009 4:01 AM

    Hi Freddy

    Assuming you split the data into NumChunks chunks, the code would look something like this:

    using DirichletArray=DistributionRefArray<Dirichlet, Vector>;
    DirichletArray phiPrior new DirichletArray(new Dirichlet(beta));
    Range TopicsNum = new Range(K);
    <Vector> sharedPhi = SharedVariable<Vector>.Random(TopicsNum, phiPrior);
    Model = new Model(NumChunks);
    VariableArray<Vector> phi = sharedPhi .GetCopyFor(Model)

    Then use phi as before in your model. You will have to explicitly do several passes, looping over the chunks as shown in the documented scalar example.


    Friday, June 3, 2011 5:19 PM