xidulu commented on a change in pull request #18403: URL: https://github.com/apache/incubator-mxnet/pull/18403#discussion_r434336610
########## File path: python/mxnet/gluon/probability/distributions/distribution.py ########## @@ -0,0 +1,196 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# coding: utf-8 +# pylint: disable=wildcard-import +"""Base distribution class.""" +__all__ = ['Distribution'] + +from .utils import cached_property +from numbers import Number + + +class Distribution(object): + r"""Base class for distribution. + + Parameters + ---------- + F : mx.ndarray or mx.symbol.numpy._Symbol + Variable that stores the running mode. + event_dim : int, default None + Variable indicating the dimension of the distribution's support. + validate_args : bool, default None + Whether to validate the distribution parameters + """ + + # Variable indicating whether the sampling method has + # pathwise gradient. + has_grad = False + support = None + has_enumerate_support = False + arg_constraints = {} + _validate_args = False + + @staticmethod + def set_default_validate_args(value): + if value not in [True, False]: + raise ValueError + Distribution._validate_args = value + + def __init__(self, F=None, event_dim=None, validate_args=None): + self.F = F Review comment: @leezu The distribution module kicked off last year, and we had most of the features finished around early January this year when our RFC was opened as one of the items for mxnet 2.0: https://github.com/apache/incubator-mxnet/issues/17240. If we take a look at the RFC for deferred compute, we can see that this RFC was still getting concerns and comments from the community members by late January: https://github.com/apache/incubator-mxnet/issues/16376#issuecomment, and the RFC for deprecating `F` was out late February: https://github.com/apache/incubator-mxnet/issues/17676. On the other hand, we did respect your effort on deferred compute when we started designing this module, and I remember during one of our earlier offline exchanges, you were not confident enough about finishing this deferred compute feature before 2.0 release. With that piece of information, we eventually decided to proceed with the traditional Gluon (with `F`) in this module. Also, just like what @szhengac said, he reached a consensus with @szha offline about keeping the `F` in this module. I don’t think it’s reasonable to ask people to predict the future and onboard a new feature that was not guaranteed to be ready. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
