Add API for DML_OPERATOR_ELEMENT_WISE_NEGATE to DirectMLX.h (#275)

This commit is contained in:
Patrice Vignola 2022-08-08 19:32:59 -07:00 коммит произвёл GitHub
Родитель bc01d97e8d
Коммит 9d05178134
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -3774,6 +3774,15 @@ namespace dml
}
#endif
#if DML_TARGET_VERSION >= 0x5000
inline Expression Negate(Expression input)
{
return detail::ElementWiseUnary<DML_OPERATOR_ELEMENT_WISE_NEGATE, DML_ELEMENT_WISE_NEGATE_OPERATOR_DESC>(input);
}
#endif // DML_TARGET_VERSION >= 0x5000
// Reinterprets the memory of a tensor with a different type and dimensions (analogously to using
// reinterpret_cast to access raw bits). Note that this is different to the DML Cast operator, which performs
// a type cast on the contents of a tensor (analogously to static_cast). The total tensor size of the output
@ -3858,8 +3867,17 @@ namespace dml
// Unary
inline Expression operator~(Expression input) { return dml::BitNot(input); }
inline Expression operator+(Expression input) { return dml::Identity(input); }
#if DML_TARGET_VERSION >= 0x5000
inline Expression operator-(Expression input) { return dml::Negate(input); }
#else
inline Expression operator-(Expression input) { return dml::Identity(input, DML_SCALE_BIAS{ -1.0f, 0.0f }); }
#endif // DML_TARGET_VERSION >= 0x5000
// Logical
inline Expression operator!(Expression a) { return dml::LogicalNot(a); }
inline Expression operator&&(Expression a, Expression b) { return dml::LogicalAnd(a, b); }