PointwiseOps.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. // Ternary and higher-order pointwise operations
  3. #pragma once
  4. #include <ATen/native/DispatchStub.h>
  5. namespace c10 {
  6. class Scalar;
  7. }
  8. namespace at {
  9. struct TensorIterator;
  10. struct TensorIteratorBase;
  11. namespace native {
  12. using pointwise_fn = void (*)(TensorIterator&, const Scalar& scalar);
  13. using structured_pointwise_fn = void (*)(TensorIteratorBase&, const Scalar& scalar);
  14. using pointwise_fn_double = void (*)(TensorIterator&, const Scalar&, double);
  15. DECLARE_DISPATCH(structured_pointwise_fn, addcmul_stub)
  16. DECLARE_DISPATCH(structured_pointwise_fn, addcdiv_stub)
  17. DECLARE_DISPATCH(pointwise_fn_double, smooth_l1_backward_stub)
  18. DECLARE_DISPATCH(pointwise_fn_double, huber_backward_stub)
  19. DECLARE_DISPATCH(pointwise_fn, mse_backward_stub)
  20. } // namespace native
  21. } // namespace at
  22. #else
  23. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  24. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)