haojin2 commented on a change in pull request #17793: [Numpy] OP_interp URL: https://github.com/apache/incubator-mxnet/pull/17793#discussion_r390011369
########## File path: src/operator/numpy/np_interp_op-inl.h ########## @@ -0,0 +1,283 @@ +/* + * 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) 2020 by Contributors + * \file np_interp_op-inl.h +*/ + +#ifndef MXNET_OPERATOR_NUMPY_NP_INTERP_OP_INL_H_ +#define MXNET_OPERATOR_NUMPY_NP_INTERP_OP_INL_H_ + +#include <vector> +#include <string> +#include <unordered_map> +#include "../tensor/ordering_op-inl.h" +#include "../tensor/matrix_op-inl.h" +#include "../tensor/elemwise_binary_scalar_op.h" +#include "../../common/utils.h" +#include "../mshadow_op.h" +#include "../operator_common.h" +#include "../elemwise_op_common.h" +#include "np_broadcast_reduce_op.h" + +namespace mxnet { +namespace op { + +struct NumpyInterpParam : public dmlc::Parameter<NumpyInterpParam> { + dmlc::optional<double> left; + dmlc::optional<double> right; + dmlc::optional<double> period; + dmlc::optional<double> x_scalar; + DMLC_DECLARE_PARAMETER(NumpyInterpParam) { + DMLC_DECLARE_FIELD(left) + .set_default(dmlc::optional<double>()) + .describe("Value to return for x < xp[0], default is fp[0]."); + DMLC_DECLARE_FIELD(right) + .set_default(dmlc::optional<double>()) + .describe("Value to return for x > xp[-1], default is fp[-1]."); + DMLC_DECLARE_FIELD(period) + .set_default(dmlc::optional<double>()) + .describe("A period for the x-coordinates. This parameter allows" + "the proper interpolation of angular x-coordinates. Parameters" + "left and right are ignored if period is specified."); + DMLC_DECLARE_FIELD(x_scalar) + .set_default(dmlc::optional<double>()) + .describe("Input x is a scalar"); + } + void SetAttrDict(std::unordered_map<std::string, std::string>* dict) { Review comment: add a blank line above ---------------------------------------------------------------- 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
