Skip to content
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

Asanyarray ascontiguousarray asfarray copy funcs #265

Merged
merged 11 commits into from
Nov 21, 2020

Conversation

Alexander-Makaryev
Copy link
Contributor

+21 passed cupy tests
+15 in tests/test_arraymanipulation.py

@@ -187,7 +187,8 @@ void func_map_init_random(func_map_t& fmap)
fmap[DPNPFuncName::DPNP_FN_GAUSSIAN][eft_DBL][eft_DBL] = {eft_DBL, (void*)custom_rng_gaussian_c<double>};
fmap[DPNPFuncName::DPNP_FN_GAUSSIAN][eft_FLT][eft_FLT] = {eft_FLT, (void*)custom_rng_gaussian_c<float>};

fmap[DPNPFuncName::DPNP_FN_NEGATIVE_BINOMIAL][eft_INT][eft_INT] = {eft_INT, (void*)custom_rng_negative_binomial_c<int>};
fmap[DPNPFuncName::DPNP_FN_NEGATIVE_BINOMIAL][eft_INT][eft_INT] = {eft_INT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does not look like these changes belong to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is a result of applying of code style tool... The correct way is to apply code style tool during work on changes, but if someone missed it, then these changes occur when I apply code style. Sometimes it is hard to split these changes in new and old code. We should improve our CI to automatic check/apply of code style.

dpnp/dparray.pyx Outdated
@@ -47,6 +47,47 @@ cimport numpy
cimport dpnp.dpnp_utils as utils


# initially copyed from original
Copy link
Contributor

Choose a reason for hiding this comment

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

copyed->copied

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

@Alexander-Makaryev it looks like it is related to #89

@@ -47,6 +47,47 @@ cimport numpy
cimport dpnp.dpnp_utils as utils


# initially copyed from original
cdef class _flagsobj:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don not understand why we need this. It is better to reuse this from NumPy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to get own behavior while we have no a full enough support of features like f-contiguous memory layout, strides, views (sharing the memory) etc. In fact at this moment we just return a constant values of flags and it will be easier to modify our own class "step by step". We can replace it with original Numpy class in future, when it will be possible to reuse original functionality. Possibly I am wrong)

Copy link
Contributor

Choose a reason for hiding this comment

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

@Alexander-Makaryev We "return a constant values" because we support one data state only at this time.
It is questionable we will support diffrent states.
Using Numpy Flags is also possible in "one state"- just construct it based on "constant values".
I think this is ambiguous code what is better to handle via "fallback" because it is not related to SYCL


if ndmin != 0:
checker_throw_value_error("array", "ndmin", ndmin, 0)

return dpnp_array(obj, dtype)


def asanyarray(a, dtype=None, order=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add block Limitations to all the docstring something like this:

    Limitations
    -----------
    Parameter ``order`` is supported only with default value `'C'`.

@shssf shssf merged commit 91f4d0c into master Nov 21, 2020
@shssf shssf deleted the asanyarray-ascontiguousarray-asfarray-funcs branch November 21, 2020 04:37
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