haojin2 commented on a change in pull request #17272: [Numpy] Add infra for performing constraint check URL: https://github.com/apache/incubator-mxnet/pull/17272#discussion_r365550300
########## File path: src/operator/numpy/np_constraint_check.h ########## @@ -0,0 +1,71 @@ +/* + * 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. + */ + +/*! + * \file np_constraint_check.h + * \brief helper function for constraint check + */ + +#ifndef MXNET_OPERATOR_NUMPY_NP_CONSTRAINT_CHECK_H_ +#define MXNET_OPERATOR_NUMPY_NP_CONSTRAINT_CHECK_H_ + +#include <algorithm> +#include <string> +#include <vector> +#include "./np_broadcast_reduce_op.h" + +namespace mxnet { +namespace op { + +template<typename xpu> +void GetReduceOutput(mshadow::Stream<xpu> *s, const TBlob &output_blob, bool *red_output); + +struct ConstraintCheckParam : public dmlc::Parameter<ConstraintCheckParam> { + std::string msg; + DMLC_DECLARE_PARAMETER(ConstraintCheckParam) { + DMLC_DECLARE_FIELD(msg) + .set_default("Constraint violated.") + .describe("Error message raised when constraint violated"); + } +}; + +template <typename xpu> +void ConstraintCheckForward(const nnvm::NodeAttrs& attrs, const OpContext& ctx, + const std::vector<TBlob>& inputs, Review comment: alignment. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services