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

Add activation functions in jax.nn module #12502

Closed
wants to merge 10,000 commits into from

Conversation

karalleyna
Copy link
Contributor

@karalleyna karalleyna commented Mar 15, 2023

JAX Frontend

  • sigmoid(x)
  • softplus(x)
  • soft_sign(x)
  • silu(x)
  • swish(x)
  • log_sigmoid(x)
  • leaky_relu(x[, negative_slope])
  • hard_sigmoid(x)
  • hard_silu(x)
  • hard_swish(x)
  • hard_tanh(x)
  • elu(x[, alpha])
  • celu(x[, alpha])
  • selu(x)
  • glu(x)

fspyridakos and others added 30 commits March 6, 2023 17:56
# Conflicts:
#	.github/workflows/test-ivy-cron-multi-version.yml
#	.github/workflows/test-ivy-cron.yml
#	ivy/array/experimental/elementwise.py
#	ivy/compiler/utils/XVX.so
#	ivy/compiler/utils/XXI.so
#	ivy/functional/backends/jax/experimental/activations.py
#	ivy/functional/backends/jax/experimental/layers.py
#	ivy/functional/backends/numpy/experimental/activations.py
#	ivy/functional/backends/numpy/experimental/elementwise.py
#	ivy/functional/backends/tensorflow/experimental/activations.py
#	ivy/functional/backends/tensorflow/experimental/elementwise.py
#	ivy/functional/backends/torch/__init__.py
#	ivy/functional/frontends/jax/numpy/mathematical_functions.py
#	ivy/functional/frontends/tensorflow/math.py
#	ivy/functional/frontends/tensorflow/nn.py
#	ivy/functional/ivy/gradients.py
#	ivy_tests/test_ivy/test_frontends/test_jax/test_jax_numpy_math.py
#	ivy_tests/test_ivy/test_frontends/test_tensorflow/test_math.py
#	ivy_tests/test_ivy/test_frontends/test_torch/test_miscellaneous_ops.py
#	ivy_tests/test_ivy/test_frontends/test_torch/test_pointwise_ops.py
#	run_tests.py
#	run_tests_CLI/cron_tests_multi_version.py
… (Incorporate Versioning in Mongo DB Schema) [skip ci]
@ivy-leaves ivy-leaves added Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards Ivy API Experimental Run CI for testing API experimental/New feature or request JAX Frontend Developing the JAX Frontend, checklist triggered by commenting add_frontend_checklist labels Mar 15, 2023
Copy link
Contributor

@fspyridakos fspyridakos left a comment

Choose a reason for hiding this comment

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

Great PR, just some suggeted changes, please remove duplicates in particular and update the docstrings. I'll take another look once you're done. Thanks!

@handle_exceptions
@handle_array_like_without_promotion
@handle_array_function
def sigmoid(
Copy link
Contributor

Choose a reason for hiding this comment

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

already implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@handle_exceptions
@handle_array_like_without_promotion
@handle_array_function
def softplus(
Copy link
Contributor

Choose a reason for hiding this comment

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

already implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@handle_exceptions
@handle_array_like_without_promotion
@handle_array_function
def leaky_relu(
Copy link
Contributor

Choose a reason for hiding this comment

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

already implemented

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Contributor

Choose a reason for hiding this comment

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

For most of these, you can use the native numpy out argument on the last operation to make it use the native out handling. For example if the last operation is division you can do np.divide(x,y,out=out)

Copy link
Contributor

Choose a reason for hiding this comment

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

Some docstrings are incorrect (remain as copies of others) please update them accrdingly

@AnnaTz
Copy link
Contributor

AnnaTz commented Mar 29, 2023

Hi @karalleyna, could you please re-make this PR? It can't get merged as it is now because of the force-push.
Also, could you reserve the functions in the original Iist to avoid other people working on them at the same time.

@ivy-seed ivy-seed added the Stale label Jun 20, 2023
@ivy-seed
Copy link

This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days.

@ivy-seed ivy-seed closed this Jun 28, 2023
@ivy-seed
Copy link

This PR has been closed because it has been marked as stale for more than 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Array API Conform to the Array API Standard, created by The Consortium for Python Data API Standards Ivy API Experimental Run CI for testing API experimental/New feature or request JAX Frontend Developing the JAX Frontend, checklist triggered by commenting add_frontend_checklist Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.