sample.address = s.Address().decode("utf-8")
sample.instance = s.Instance()
value = s.Value()
if not value is None:
sample.value = NDArray_to_Tensor(value)
distribution_type = s.DistributionType()
if distribution_type != infcomp.protocol.Distribution.Distribution().NONE:
if distribution_type == infcomp.protocol.Distribution.Distribution().UniformDiscrete:
p = infcomp.protocol.UniformDiscrete.UniformDiscrete()
After Change
p = infcomp.protocol.UniformDiscrete.UniformDiscrete()
p.Init(s.Distribution().Bytes, s.Distribution().Pos)
distribution = UniformDiscrete(p.PriorMin(), p.PriorSize())
if value.dim() > 0:
value = util.one_hot(distribution.prior_size, int(value[0]) - distribution.prior_min)
elif distribution_type == infcomp.protocol.Distribution.Distribution().MultivariateNormal:
p = infcomp.protocol.MultivariateNormal.MultivariateNormal()
p.Init(s.Distribution().Bytes, s.Distribution().Pos)
distribution = MultivariateNormal(NDArray_to_Tensor(p.PriorMean()), NDArray_to_Tensor(p.PriorCov()))