Skip to content

Kernel abs #104

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 2 commits into from
Oct 1, 2020
Merged

Kernel abs #104

merged 2 commits into from
Oct 1, 2020

Conversation

Rubtsowa
Copy link
Contributor

@Rubtsowa Rubtsowa commented Oct 1, 2020

No description provided.

void* result1,
size_t size)
{
if (!size)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, It is better to add size check on cython level.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samir-nasibli it should be here. Let's imagine if somebody will call this kernels from C++ application.

@codecov
Copy link

codecov bot commented Oct 1, 2020

Codecov Report

Merging #104 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #104   +/-   ##
=======================================
  Coverage   51.45%   51.45%           
=======================================
  Files          19       19           
  Lines        1201     1201           
  Branches      312      312           
=======================================
  Hits          618      618           
  Misses        333      333           
  Partials      250      250           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff875ab...da7d8f4. Read the comment docs.

@shssf shssf merged commit 605416c into IntelPython:master Oct 1, 2020

template <typename _DataType>
void custom_elemwise_absolute_c(void* array1_in,
const std::vector<long>& input_shape,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa Please avoid of using complex types like std::vector in interface, if you need to provide set of values then use pointers. At this moment it is hard to use such params in calls from another projects like Numba, for example. We already had discussions about it.
But in this function this param is useless at all. You don't need it and you didn't use this param, look at another comments.

Comment on lines +53 to +55
const size_t input_shape_size = input_shape.size();
size_t* input_offset_shape = reinterpret_cast<size_t*>(dpnp_memory_alloc_c(input_shape_size * sizeof(long)));
size_t* result_offset_shape = reinterpret_cast<size_t*>(dpnp_memory_alloc_c(input_shape_size * sizeof(long)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa This code is useless. BTW it is only place where input_shape is used.

Comment on lines +62 to +63
DPNP_FN_NONE, /**< Very first element of the enumeration */
DPNP_FN_ABSOLUTE, /**< Used in numpy.absolute() implementation */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa These rows show that codestyle was not applied. Please use codestyle tools.

*
* @param [in] array1_in Input array.
*
* @param [in] input_shape Input shape.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa Unnecessary param

*/
template <typename _DataType>
INP_DLLEXPORT void custom_elemwise_absolute_c(void* array1_in,
const std::vector<long>& input_shape,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa Unnecessary param

Comment on lines +82 to +97
template void custom_elemwise_absolute_c<double>(void* array1_in,
const std::vector<long>& input_shape,
void* result1,
size_t size);
template void custom_elemwise_absolute_c<float>(void* array1_in,
const std::vector<long>& input_shape,
void* result1,
size_t size);
template void custom_elemwise_absolute_c<long>(void* array1_in,
const std::vector<long>& input_shape,
void* result1,
size_t size);
template void custom_elemwise_absolute_c<int>(void* array1_in,
const std::vector<long>& input_shape,
void* result1,
size_t size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa input_shape is unnecessary param

@@ -63,54 +63,29 @@ __all__ += [
]


ctypedef void(*fptr_custom_elemwise_absolute_1in_1out_t)(void *, dparray_shape_type &,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa Unnecessary param


cdef fptr_custom_elemwise_absolute_1in_1out_t func = <fptr_custom_elemwise_absolute_1in_1out_t > kernel_data.ptr
# call FPTR function
func(input.get_data(), input_shape, result.get_data(), input.size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa Unnecessary param

dpnp_result_array = dpnp_array.reshape(output_shape)
return dpnp_result_array
cdef dparray_shape_type input_shape = input.shape
cdef size_t input_shape_size = input.ndim
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa input_shape_size is not used

dpnp_array = dpnp.array(result_array, dtype=input.dtype)
dpnp_result_array = dpnp_array.reshape(output_shape)
return dpnp_result_array
cdef dparray_shape_type input_shape = input.shape
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rubtsowa Unnecessary param

@Alexander-Makaryev Alexander-Makaryev mentioned this pull request Oct 14, 2020
@Rubtsowa Rubtsowa deleted the kernel_abs branch October 20, 2020 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants