Beispiel #1
0
	size_t replace(C& chosen) const
	{
		size_t x = repeat(chosen);
		chosen[x] = true;
		return x;
	}
Beispiel #2
0
 list_inserter& operator,( assign_detail::repeater<T> r )
 {
     return repeat( r.sz, r.val ); 
 }
Beispiel #3
0
	array <size_t, S>& repeat(array <size_t, S>& X, const C& chosen) const
	{
		for(size_t n = 0; n < X.length(); n++)
			X[n] = repeat(chosen);
		return X;
	}
void StdoutWriter::write(const std::string & message) {
  _message = message;
  repeat();
}
Beispiel #5
0
 static constexpr decltype(auto) apply() {
     auto zeros = repeat(int_<C>, int_<0>);
     return unpack(repeat(int_<R>, zeros), cppcon::matrix);
 }
    bool forward_ocl(InputArrayOfArrays inputs_, OutputArrayOfArrays outputs_, OutputArrayOfArrays internals_)
    {
        std::vector<UMat> inputs;
        std::vector<UMat> outputs;
        std::vector<UMat> internals;

        inputs_.getUMatVector(inputs);
        outputs_.getUMatVector(outputs);
        internals_.getUMatVector(internals);

        CV_Assert(inputs.size() == 1 && outputs.size() == 1);
        CV_Assert(inputs[0].total() == outputs[0].total());

        const UMat& inp0 = inputs[0];
        UMat& buffer = internals[0];
        size_t num = inp0.size[0];
        size_t channels = inp0.size[1];
        size_t channelSize = inp0.total() / (num * channels);
        for (size_t i = 0; i < num; ++i)
        {
            MatShape s = shape(channels, channelSize);
            UMat src = inputs[i].reshape(1, s.size(), &s[0]);
            UMat dst = outputs[i].reshape(1, s.size(), &s[0]);

            UMat abs_mat;
            absdiff(src, cv::Scalar::all(0), abs_mat);
            pow(abs_mat, pnorm, buffer);

            if (acrossSpatial)
            {
                // add eps to avoid overflow
                float absSum = sum(buffer)[0] + epsilon;
                float norm = pow(absSum, 1.0f / pnorm);
                multiply(src, 1.0f / norm, dst);
            }
            else
            {
                Mat norm;
                reduce(buffer, norm, 0, REDUCE_SUM);
                norm += epsilon;

                // compute inverted norm to call multiply instead divide
                cv::pow(norm, -1.0f / pnorm, norm);

                repeat(norm, channels, 1, buffer);
                multiply(src, buffer, dst);
            }

            if (!blobs.empty())
            {
                // scale the output
                Mat scale = blobs[0];
                if (scale.total() == 1)
                {
                    // _scale: 1 x 1
                    multiply(dst, scale.at<float>(0, 0), dst);
                }
                else
                {
                    // _scale: _channels x 1
                    CV_Assert(scale.total() == channels);
                    repeat(scale, 1, dst.cols, buffer);
                    multiply(dst, buffer, dst);
                }
            }
        }
        return true;
    }
Beispiel #7
0
static tactic * mk_der_fp_tactic(ast_manager & m, params_ref const & p) {
    return repeat(and_then(mk_der_tactic(m), mk_simplify_tactic(m, p)));
}