Skip to content

New API from Upstream Release 3.7.0 #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix product functions output Array type
For boolean/char inputs to ArrayFire, the output of product operation
is char and everywhere else same as AggregateType alias.
  • Loading branch information
9prady9 committed Mar 13, 2020
commit 3e3f3a820aeec870520a80cd5f1814416accd8b7
6 changes: 3 additions & 3 deletions src/algorithm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ dim_reduce_func_def!(
",
product,
af_product,
T::AggregateOutType
T::ProductOutType
);

dim_reduce_func_def!(
Expand Down Expand Up @@ -440,10 +440,10 @@ where
/// # Return Values
///
/// Array that is reduced along given dimension via multiplication operation
pub fn product_nan<T>(input: &Array<T>, dim: i32, nanval: f64) -> Array<T::AggregateOutType>
pub fn product_nan<T>(input: &Array<T>, dim: i32, nanval: f64) -> Array<T::ProductOutType>
where
T: HasAfEnum,
T::AggregateOutType: HasAfEnum,
T::ProductOutType: HasAfEnum,
{
let mut temp: i64 = 0;
unsafe {
Expand Down
16 changes: 15 additions & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@ pub trait HasAfEnum {
/// aggregation of set of values for a given input type. Aggregate type
/// alias points to below types for given input types:
/// - `Self` for input types: `Complex<64>`, `Complex<f32>`, `f64`, `f32`, `i64`, `u64`
/// - `f32` for input types: `bool`
/// - `u32` for input types: `bool`
/// - `u32` for input types: `u8`
/// - `i32` for input types: `i16`
/// - `u32` for input types: `u16`
/// - `i32` for input types: `i32`
/// - `u32` for input types: `u32`
type AggregateOutType;
/// This type is different for b8 input type
type ProductOutType;
/// This type alias points to the output type for given input type of
/// sobel filter operation. Sobel filter output alias points to below
/// types for given input types:
Expand All @@ -211,6 +213,7 @@ impl HasAfEnum for Complex<f32> {
type ComplexOutType = Self;
type MeanOutType = Self;
type AggregateOutType = Self;
type ProductOutType = Self;
type SobelOutType = Self;

fn get_af_dtype() -> DType {
Expand All @@ -226,6 +229,7 @@ impl HasAfEnum for Complex<f64> {
type ComplexOutType = Self;
type MeanOutType = Self;
type AggregateOutType = Self;
type ProductOutType = Self;
type SobelOutType = Self;

fn get_af_dtype() -> DType {
Expand All @@ -241,6 +245,7 @@ impl HasAfEnum for f32 {
type ComplexOutType = Complex<f32>;
type MeanOutType = Self;
type AggregateOutType = Self;
type ProductOutType = Self;
type SobelOutType = Self;

fn get_af_dtype() -> DType {
Expand All @@ -256,6 +261,7 @@ impl HasAfEnum for f64 {
type ComplexOutType = Complex<f64>;
type MeanOutType = Self;
type AggregateOutType = Self;
type ProductOutType = Self;
type SobelOutType = Self;

fn get_af_dtype() -> DType {
Expand All @@ -271,6 +277,7 @@ impl HasAfEnum for bool {
type ComplexOutType = Complex<f32>;
type MeanOutType = f32;
type AggregateOutType = u32;
type ProductOutType = bool;
type SobelOutType = i32;

fn get_af_dtype() -> DType {
Expand All @@ -286,6 +293,7 @@ impl HasAfEnum for u8 {
type ComplexOutType = Complex<f32>;
type MeanOutType = f32;
type AggregateOutType = u32;
type ProductOutType = u32;
type SobelOutType = i32;

fn get_af_dtype() -> DType {
Expand All @@ -301,6 +309,7 @@ impl HasAfEnum for i16 {
type ComplexOutType = Complex<f32>;
type MeanOutType = f32;
type AggregateOutType = i32;
type ProductOutType = i32;
type SobelOutType = i32;

fn get_af_dtype() -> DType {
Expand All @@ -316,6 +325,7 @@ impl HasAfEnum for u16 {
type ComplexOutType = Complex<f32>;
type MeanOutType = f32;
type AggregateOutType = u32;
type ProductOutType = u32;
type SobelOutType = i32;

fn get_af_dtype() -> DType {
Expand All @@ -331,6 +341,7 @@ impl HasAfEnum for i32 {
type ComplexOutType = Complex<f32>;
type MeanOutType = f32;
type AggregateOutType = i32;
type ProductOutType = i32;
type SobelOutType = i32;

fn get_af_dtype() -> DType {
Expand All @@ -346,6 +357,7 @@ impl HasAfEnum for u32 {
type ComplexOutType = Complex<f32>;
type MeanOutType = f32;
type AggregateOutType = u32;
type ProductOutType = u32;
type SobelOutType = i32;

fn get_af_dtype() -> DType {
Expand All @@ -361,6 +373,7 @@ impl HasAfEnum for i64 {
type ComplexOutType = Complex<f64>;
type MeanOutType = f64;
type AggregateOutType = Self;
type ProductOutType = Self;
type SobelOutType = i64;

fn get_af_dtype() -> DType {
Expand All @@ -376,6 +389,7 @@ impl HasAfEnum for u64 {
type ComplexOutType = Complex<f64>;
type MeanOutType = f64;
type AggregateOutType = Self;
type ProductOutType = Self;
type SobelOutType = i64;

fn get_af_dtype() -> DType {
Expand Down