MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BinaryUFunc

Class BinaryUFunc

tensorflow/compiler/xla/python/bfloat16.cc:793–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791
792template <typename InType, typename OutType, typename Functor>
793struct BinaryUFunc {
794 static std::vector<int> Types() {
795 return {TypeDescriptor<InType>::Dtype(), TypeDescriptor<InType>::Dtype(),
796 TypeDescriptor<OutType>::Dtype()};
797 }
798 static void Call(char** args, npy_intp* dimensions, npy_intp* steps,
799 void* data) {
800 const char* i0 = args[0];
801 const char* i1 = args[1];
802 char* o = args[2];
803 for (npy_intp k = 0; k < *dimensions; k++) {
804 auto x = *reinterpret_cast<const typename TypeDescriptor<InType>::T*>(i0);
805 auto y = *reinterpret_cast<const typename TypeDescriptor<InType>::T*>(i1);
806 *reinterpret_cast<typename TypeDescriptor<OutType>::T*>(o) =
807 Functor()(x, y);
808 i0 += steps[0];
809 i1 += steps[1];
810 o += steps[2];
811 }
812 }
813};
814
815template <typename InType, typename InType2, typename OutType, typename Functor>
816struct BinaryUFunc2 {

Callers 1

bfloat16.ccFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected