full.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "ultra_infer/core/fd_scalar.h"
  16. #include "ultra_infer/core/fd_tensor.h"
  17. namespace ultra_infer {
  18. namespace function {
  19. /** Fill the value to tensor
  20. @param value The value to be filled in tensor
  21. @param shape The shape of output tensor.
  22. @param out The output tensor which stores the result.
  23. @param dtype The data type of output tensor. Default to float32
  24. */
  25. ULTRAINFER_DECL void Full(const Scalar &value,
  26. const std::vector<int64_t> &shape, FDTensor *out,
  27. FDDataType dtype = FDDataType::FP32);
  28. /** Fill the value to tensor
  29. @param x The input tensor.
  30. @param value The value to be filled in tensor
  31. @param out The output tensor which stores the result.
  32. @param dtype The data type of output tensor. Default to float32
  33. */
  34. ULTRAINFER_DECL void FullLike(const FDTensor &x, const Scalar &value,
  35. FDTensor *out,
  36. FDDataType dtype = FDDataType::FP32);
  37. } // namespace function
  38. } // namespace ultra_infer