Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-357] New Scala API Design (NDArray) #10787

Merged
merged 5 commits into from
May 23, 2018

Conversation

lanking520
Copy link
Member

@lanking520 lanking520 commented May 2, 2018

Description

See full design document
@nswamy @yzhliu
This PR is the Addition for new NDArray functions of Scala API
Warning: current PR expose underscore functions

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • Use QuasiQuote to replace original API Implementation (Reduce lines)
  • MakeAtomicFunction change to support String type parameter type in
  • User New namespace for New API (temporarily NDArray.api.function_name)
  • Default args using None to pass in as default
  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@lanking520 lanking520 requested a review from yzhliu as a code owner May 2, 2018 22:51
@lanking520 lanking520 changed the title [MXNET-357][WIP] New Scala API Design (NDArray) [MXNET-357] New Scala API Design (NDArray) May 3, 2018
@lanking520
Copy link
Member Author

NDArray one is in Sync with #10660

@@ -102,20 +178,80 @@ private[mxnet] object NDArrayMacro {
result
}


// Convert C++ Types to Scala Types
private def typeConversion(in : String, argType : String = "") : String = {
Copy link
Member

Choose a reason for hiding this comment

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

can we have these functions shared with those in SymbolMacro?

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's change it in Document integration component PR, we can do a global migration on Symbol, NDArray there. Any recommendation where we put these functions? As a single file or inside SymbolMacros.

var argDef = ListBuffer[String]()
ndarrayfunction.listOfArgs.foreach(ndarrayarg => {
val currArgName = ndarrayarg.argName match {
case "var" => "vari"
Copy link
Member

Choose a reason for hiding this comment

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

please add comments why you are transforming these.

})
argDef += "name : String = null"
argDef += "attr : Map[String, String] = null"
// Construct Implementation field
Copy link
Member

Choose a reason for hiding this comment

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

can you expand the comment on why you are doing it here again
ie., you are still taking all the parameters and sending that across the JNI boundary as a map otherwise it would need to rewrite all JNI API implementation to match these. There is a small problem with this approach, we are not tying the type the backend expects from the Scala API. ie., we might by mistake generate a different type(if the mapping below is wrong)

@lanking520
Copy link
Member Author

Add 1 line change in Sync with this PR: #11021

@yzhliu yzhliu merged commit b0d632f into apache:master May 23, 2018
jinhuang415 pushed a commit to jinhuang415/incubator-mxnet that referenced this pull request May 29, 2018
* Add new NDArray APIs

* Add NDArray APIs

* change the impl into individual functions and add comments

* Quick fix on redudant code

* Change in Sync
rahul003 pushed a commit to rahul003/mxnet that referenced this pull request Jun 4, 2018
* Add new NDArray APIs

* Add NDArray APIs

* change the impl into individual functions and add comments

* Quick fix on redudant code

* Change in Sync
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 28, 2018
* Add new NDArray APIs

* Add NDArray APIs

* change the impl into individual functions and add comments

* Quick fix on redudant code

* Change in Sync
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants