haojin2 commented on a change in pull request #16152: [Numpy] Random.gamma() 
implemented
URL: https://github.com/apache/incubator-mxnet/pull/16152#discussion_r364377164
 
 

 ##########
 File path: src/operator/numpy/random/np_gamma_op.h
 ##########
 @@ -0,0 +1,422 @@
+/*
+ * 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.
+ */
+
+/*!
+ * Copyright (c) 2019 by Contributors
+ * \file np_gamma_op.h
+ * \brief Operator for random sampling from gamma distribution
+ */
+
+#ifndef MXNET_OPERATOR_NUMPY_RANDOM_NP_GAMMA_OP_H_
+#define MXNET_OPERATOR_NUMPY_RANDOM_NP_GAMMA_OP_H_
+
+#include <mxnet/operator_util.h>
+#include <mshadow/base.h>
+#include <vector>
+#include <string>
+#include <algorithm>
+#include "./dist_common.h"
+#include "../../elemwise_op_common.h"
+#include "../../tensor/elemwise_binary_broadcast_op.h"
+#include "../../mshadow_op.h"
+#include "../../mxnet_op.h"
+#include "../../operator_common.h"
+
+#define M 2
+
+namespace mxnet {
+namespace op {
+
+struct NumpyGammaParam : public dmlc::Parameter<NumpyGammaParam> {
+  dmlc::optional<float> shape;
+  dmlc::optional<float> scale;
+  std::string ctx;
+  int dtype;
+  dmlc::optional<mxnet::Tuple<int>> size;
+  DMLC_DECLARE_PARAMETER(NumpyGammaParam) {
+    DMLC_DECLARE_FIELD(shape);
+    DMLC_DECLARE_FIELD(scale);
+    DMLC_DECLARE_FIELD(size)
+        .set_default(dmlc::optional<mxnet::Tuple<int>>())
+        .describe("Output shape. If the given shape is, "
+                  "e.g., (m, n, k), then m * n * k samples are drawn. "
+                  "Default is None, in which case a single value is 
returned.");
+    DMLC_DECLARE_FIELD(ctx)
+    .set_default("xpu")
+    .describe("Context of output, in format [xpu|xpu|xpu_pinned](n)."
+              " Only used for imperative calls.");
+    DMLC_DECLARE_FIELD(dtype)
+    .add_enum("float32", mshadow::kFloat32)
 
 Review comment:
   2-space indentation.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to