Function mindspore::dataset::Multiply

Function Documentation

bool mindspore::dataset::Multiply(const LiteMat &src_a, const LiteMat &src_b, LiteMat *dst)

Given image A and image B and calculate the product of them (A * B). This is an element by element operation by multiplying corresponding elements of inputs.

Example
std::vector<uint8_t> mat1 = {4, 4, 4, 4};
LiteMat lite_mat_src;
lite_mat_src.Init(2, 2, 1, mat1.data(), LDataType::UINT8);

std::vector<uint8_t> mat2 = {2, 2, 2, 2};
LiteMat lite_mat_src2;
lite_mat_src2.Init(2, 2, 1, mat2.data(), LDataType::UINT8);

/* Calculate the product of images */
LiteMat mut;
Multiply(lite_mat_src, lite_mat_src2, &mut);
for (int i = 0; i < mut.height_; i++) {
  for (int j = 0; j < mut.width_; j++) {
    std::cout << std::to_string(mut.ptr<uint8_t>(i)[j]) << ", ";
  }
  std::cout << std::endl;
}

参数
  • src_a[in] Input image data.

  • src_b[in] Input image data.

  • dst[in] The product of input images.

返回

Return true if transform successfully.