Added broadcastable IGamma and IGammac ops.

master
shugeo 2019-10-16 13:58:32 +03:00
parent f90e6da97e
commit 7103aca8c5
4 changed files with 64 additions and 3 deletions

View File

@ -78,7 +78,9 @@
(28, LogicalXor) ,\
(29, LogicalNot) ,\
(30, LogicalAnd), \
(31, DivideNoNan)
(31, DivideNoNan), \
(32, IGamma), \
(33, IGammac)
// these ops return same data type as input
#define TRANSFORM_SAME_OPS \
@ -245,7 +247,9 @@
(43, TruncateMod) ,\
(44, SquaredReverseSubtract) ,\
(45, ReversePow), \
(46, DivideNoNan)
(46, DivideNoNan), \
(47, IGamma), \
(48, IGammac)
@ -380,7 +384,9 @@
(35, AMinPairwise) ,\
(36, TruncateMod), \
(37, ReplaceNans), \
(38, DivideNoNan)
(38, DivideNoNan), \
(39, IGamma), \
(40, IGammac)

View File

@ -49,6 +49,8 @@ namespace nd4j {
static BroadcastOpsTuple DivideNoNan();
static BroadcastOpsTuple Multiply();
static BroadcastOpsTuple Subtract();
static BroadcastOpsTuple IGamma();
static BroadcastOpsTuple IGammac();
};
}

View File

@ -48,4 +48,11 @@ namespace nd4j {
BroadcastOpsTuple BroadcastOpsTuple::Subtract() {
return custom(nd4j::scalar::Subtract, nd4j::pairwise::Subtract, nd4j::broadcast::Subtract);
}
BroadcastOpsTuple BroadcastOpsTuple::IGamma() {
return custom(nd4j::scalar::IGamma, nd4j::pairwise::IGamma, nd4j::broadcast::IGamma);
}
BroadcastOpsTuple BroadcastOpsTuple::IGammac() {
return custom(nd4j::scalar::IGammac, nd4j::pairwise::IGammac, nd4j::broadcast::IGammac);
}
}

View File

@ -1482,6 +1482,52 @@ namespace simdOps {
};
template <typename X, typename Y, typename Z>
class IGamma {
public:
no_op_exec_special
no_op_exec_special_cuda
op_def static Z op(X d1, Z *params) {
return nd4j::math::nd4j_igamma<X, X, Z>(d1, params[0]);
}
op_def static Z op(X d1, Y d2) {
return nd4j::math::nd4j_igamma<X, Y, Z>(d1, d2);
}
op_def static Z op(X d1, Y d2, Z *params) {
return nd4j::math::nd4j_igamma<X, Y, Z>(d1, d2);
}
op_def static Z op(X d1) {
return d1;
}
};
template <typename X, typename Y, typename Z>
class IGammac {
public:
no_op_exec_special
no_op_exec_special_cuda
op_def static Z op(X d1, Z *params) {
return nd4j::math::nd4j_igammac<X, X, Z>(d1, params[0]);
}
op_def static Z op(X d1, Y d2) {
return nd4j::math::nd4j_igammac<X, Y, Z>(d1, d2);
}
op_def static Z op(X d1, Y d2, Z *params) {
return nd4j::math::nd4j_igammac<X, Y, Z>(d1, d2);
}
op_def static Z op(X d1) {
return d1;
}
};
template <typename X>
class Round {
public: