Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Apply review suggestions
  • Loading branch information
ndgrigorian committed Sep 5, 2024
1 parent d9dab91 commit 6bde41f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
11 changes: 2 additions & 9 deletions dpctl/tensor/_statistical_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,8 @@ def _var_impl(x, axis, correction, keepdims):
res_shape = res.shape
# when nelems - correction <= 0, yield nans
div = max(nelems - correction, 0)
if div:
dep_evs = _manager.submitted_events
ht_e7, d_e2 = tei._divide_by_scalar(
src=res, scalar=div, dst=res, sycl_queue=q, depends=dep_evs
)
_manager.add_event_pair(ht_e7, d_e2)
return res, [d_e2]

div = dpt.nan
if not div:
div = dpt.nan
dep_evs = _manager.submitted_events
ht_e7, d_e2 = tei._divide_by_scalar(
src=res, scalar=div, dst=res, sycl_queue=q, depends=dep_evs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,27 +313,32 @@ py_divide_by_scalar(const dpctl::tensor::usm_ndarray &src,
fn = divide_by_scalar<sycl::half, sycl::half>;
std::ignore =
new (scalar_alloc) sycl::half(static_cast<sycl::half>(scalar));
} break;
break;
}
case float32_typeid:
{
fn = divide_by_scalar<float, float>;
std::ignore = new (scalar_alloc) float(scalar);
} break;
break;
}
case float64_typeid:
{
fn = divide_by_scalar<double, double>;
std::ignore = new (scalar_alloc) double(scalar);
} break;
break;
}
case complex64_typeid:
{
fn = divide_by_scalar<std::complex<float>, float>;
std::ignore = new (scalar_alloc) float(scalar);
} break;
break;
}
case complex128_typeid:
{
fn = divide_by_scalar<std::complex<double>, double>;
std::ignore = new (scalar_alloc) double(scalar);
} break;
break;
}
default:
throw std::runtime_error("Implementation is missing for typeid=" +
std::to_string(src_typeid));
Expand Down

0 comments on commit 6bde41f

Please sign in to comment.