You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mxnet.apache.org by Anirudh Acharya <an...@gmail.com> on 2018/07/23 20:42:24 UTC

Duplication of Operators for sampling from random distributions

Hi All,

I had earlier filed an issue with functionality-duplication/code-refactor
here - https://github.com/apache/incubator-mxnet/issues/11811

As per the suggestion in the github issue I would like to bring it to the
attention of the wider community -

The operators defined in sample_op.cc and multisample_op.cc are seemingly
performing the same tasks. Both these files define the following operators
respectively

sample_op.cc
-----------
random_uniform
random_normal
random_gamma
random_exponential
random_poisson
random_negative_binomial
random_generalized_negative_binomial

multisample_op.cc
----------
sample_uniform
sample_normal
sample_gamma
sample_exponential
sample_poisson
sample_negative_binomial
sample_generalized_negative_binomial

The only difference that I can glean from the documentation is that
operators in multisample_op.ccperforms concurrent sampling from multiple
distributions, but the behavior of the operators is not different.

Is sample_op.cc being retained for legacy reasons or backward
compatibility? Can it be deprecated or EOLed? Correct me if I am wrong here.


Thanks

Anirudh

Re: Duplication of Operators for sampling from random distributions

Posted by Anirudh Acharya <an...@gmail.com>.
Thank for the reply and the clarification, Haibin.

On Tue, Jul 24, 2018 at 2:31 PM Haibin Lin <ha...@gmail.com> wrote:

> Hi Anirudh,
>
> Thanks for asking this on dev@. I looked at the doc for sample_uniform and
> random_uniform, and found that the API is different. For sample_uniform,
> the type of arguments `low` and `high` is NDArray, while that of
> random_uniform's is float. I don't think they're going to be deprecated.
>
> The recommended API to generate a random number is via the ndarray.random.*
> or symbol.random.*, which accept both float and NDArray, and under the hood
> invoke either sample_xxx or random_xxx correspondingly.
>
> Best,
> Haibin
>
> On Mon, Jul 23, 2018 at 1:42 PM, Anirudh Acharya <an...@gmail.com>
> wrote:
>
> > Hi All,
> >
> > I had earlier filed an issue with functionality-duplication/code-refactor
> > here - https://github.com/apache/incubator-mxnet/issues/11811
> >
> > As per the suggestion in the github issue I would like to bring it to the
> > attention of the wider community -
> >
> > The operators defined in sample_op.cc and multisample_op.cc are seemingly
> > performing the same tasks. Both these files define the following
> operators
> > respectively
> >
> > sample_op.cc
> > -----------
> > random_uniform
> > random_normal
> > random_gamma
> > random_exponential
> > random_poisson
> > random_negative_binomial
> > random_generalized_negative_binomial
> >
> > multisample_op.cc
> > ----------
> > sample_uniform
> > sample_normal
> > sample_gamma
> > sample_exponential
> > sample_poisson
> > sample_negative_binomial
> > sample_generalized_negative_binomial
> >
> > The only difference that I can glean from the documentation is that
> > operators in multisample_op.ccperforms concurrent sampling from multiple
> > distributions, but the behavior of the operators is not different.
> >
> > Is sample_op.cc being retained for legacy reasons or backward
> > compatibility? Can it be deprecated or EOLed? Correct me if I am wrong
> > here.
> >
> >
> > Thanks
> >
> > Anirudh
> >
>

Re: Duplication of Operators for sampling from random distributions

Posted by Haibin Lin <ha...@gmail.com>.
Hi Anirudh,

Thanks for asking this on dev@. I looked at the doc for sample_uniform and
random_uniform, and found that the API is different. For sample_uniform,
the type of arguments `low` and `high` is NDArray, while that of
random_uniform's is float. I don't think they're going to be deprecated.

The recommended API to generate a random number is via the ndarray.random.*
or symbol.random.*, which accept both float and NDArray, and under the hood
invoke either sample_xxx or random_xxx correspondingly.

Best,
Haibin

On Mon, Jul 23, 2018 at 1:42 PM, Anirudh Acharya <an...@gmail.com>
wrote:

> Hi All,
>
> I had earlier filed an issue with functionality-duplication/code-refactor
> here - https://github.com/apache/incubator-mxnet/issues/11811
>
> As per the suggestion in the github issue I would like to bring it to the
> attention of the wider community -
>
> The operators defined in sample_op.cc and multisample_op.cc are seemingly
> performing the same tasks. Both these files define the following operators
> respectively
>
> sample_op.cc
> -----------
> random_uniform
> random_normal
> random_gamma
> random_exponential
> random_poisson
> random_negative_binomial
> random_generalized_negative_binomial
>
> multisample_op.cc
> ----------
> sample_uniform
> sample_normal
> sample_gamma
> sample_exponential
> sample_poisson
> sample_negative_binomial
> sample_generalized_negative_binomial
>
> The only difference that I can glean from the documentation is that
> operators in multisample_op.ccperforms concurrent sampling from multiple
> distributions, but the behavior of the operators is not different.
>
> Is sample_op.cc being retained for legacy reasons or backward
> compatibility? Can it be deprecated or EOLed? Correct me if I am wrong
> here.
>
>
> Thanks
>
> Anirudh
>