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

[clojure][generator][WIP] add proper newlines in generated files #14744

Conversation

Chouffe
Copy link
Contributor

@Chouffe Chouffe commented Apr 19, 2019

Description

It will reformat the current ndarray-api and symbol-api with proper newlines.

Example:

(defn
 activation
 "Applies an activation function element-wise to the input.

The following activation functions are supported:

- `relu`: Rectified Linear Unit, :math:`y = max(x, 0)`
- `sigmoid`: :math:`y = \\frac{1}{1 + exp(-x)}`
- `tanh`: Hyperbolic tangent, :math:`y = \\frac{exp(x) - exp(-x)}{exp(x) + exp(-x)}`
- `softrelu`: Soft ReLU, or SoftPlus, :math:`y = log(1 + exp(x))`
- `softsign`: :math:`y = \\frac{x}{1 + abs(x)}`



Defined in src/operator/nn/activation.cc:L167

`data`: The input array.
`act-type`: Activation function to be applied.
`out`: Output array. (optional)
"
 ([data act-type] (activation {:data data, :act-type act-type}))
 ([{:keys [data act-type out], :or {out nil}, :as opts}]
  (util/coerce-return
   (NDArrayAPI/Activation data act-type (util/->option out)))))

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • 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

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@Chouffe Chouffe requested a review from gigasquid as a code owner April 19, 2019 13:59
@Chouffe
Copy link
Contributor Author

Chouffe commented Apr 19, 2019

PTAL @kedarbellare. I am not sure this will work for :math formula especially with the \nabla... But we can probably start from there.

[filename]
(let [content (slurp filename)
formatted-content (-> content
(clojure.string/replace #"\\n" "\n")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This gets rid of the \\nabla problem but turns 2 newlines into 1.

(clojure.string/replace #"([^\\])(\\n)+" "$1\n")

@Chouffe Chouffe changed the title [clojure][generator] add proper newlines in generated files [clojure][generator][WIP] add proper newlines in generated files Apr 19, 2019
@Roshrini Roshrini added Clojure pr-work-in-progress PR is still work in progress labels Apr 19, 2019
@gigasquid
Copy link
Member

oh cool - this will be cool 💯

@Chouffe
Copy link
Contributor Author

Chouffe commented Apr 25, 2019

I will close this as @kedarbellare implemented it in his branch

@Chouffe Chouffe closed this Apr 25, 2019
@Chouffe Chouffe deleted the chouffe/clojure-generator-proper-newlines branch April 25, 2019 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Clojure pr-work-in-progress PR is still work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants