| 702 | // output scalar type is R. |
| 703 | template <typename T, typename F, typename R = T> |
| 704 | struct base { |
| 705 | // func defines operator() and its vectorized version packetOp(). |
| 706 | typedef F func; |
| 707 | |
| 708 | // If true, the functor's corresponding binary op will instantiate |
| 709 | // specialized kernels to perform an optimized broadcast |
| 710 | // operation. Each functor for which this is enabled increases the |
| 711 | // code size, so by default this is disabled for binary functors and |
| 712 | // is enabled on a per-op basis as needed. |
| 713 | static const bool use_bcast_optimization = false; |
| 714 | |
| 715 | // operator() has the signature: |
| 716 | // out_type operator()(in_type in0, in_type in1 ...) |
| 717 | typedef R out_type; |
| 718 | typedef T in_type; |
| 719 | |
| 720 | // TensorFlow provides tensor-ized version of "func". Roughly |
| 721 | // speaking, the tensorflow operation has the signature: |
| 722 | // tout_type op(tin_type in0) |
| 723 | // tout_type op(tin_type in0, tin_type in1) |
| 724 | // tout_type op(tin_type in0, in_type scalar) |
| 725 | typedef typename TTypes<out_type>::Flat tout_type; |
| 726 | typedef typename TTypes<in_type>::ConstFlat tin_type; |
| 727 | typedef typename TTypes<in_type>::ConstScalar tscalar_type; |
| 728 | |
| 729 | // Whether the functor can error out. Currently applies only to integer |
| 730 | // div and mod. |
| 731 | static const bool has_errors = false; |
| 732 | }; |
| 733 | |
| 734 | // For now, we only apply certain speed optimization for |
| 735 | // float/double's broadcast binary op. |
no outgoing calls