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

Softmax issue 46 #56

Merged
merged 13 commits into from
May 16, 2019
Merged

Softmax issue 46 #56

merged 13 commits into from
May 16, 2019

Conversation

owulveryck
Copy link
Contributor

No description provided.

This should allow to implement axis!=1
By now, only the simple example is passing the tests.
The problem is related to the comment in the ONNX definition:

Input does not need to explicitly be a 2D vector; rather, it will be coerced into one. For an arbitrary n-dimensional tensor input \in [a_0, a_1, ..., a_{k-1}, a_k, ..., a_{n-1}] and k is the axis provided, then input will be coerced into a 2-dimensional tensor with dimensions [a_0 * ... * a_{k-1}, a_k * ... * a_{n-1}]. For the default case where axis=1, this means the input tensor will be coerced into a 2D tensor of dimensions [a_0, a_1 * ... * a_{n-1}], where a_0 is often the batch size. In this situation, we must have a_0 = N and a_1 * ... * a_{n-1} = D. Each of these dimensions must be matched correctly, or else the operator will throw errors.
@owulveryck owulveryck merged commit ed0af19 into master May 16, 2019
@owulveryck owulveryck deleted the softmax-issue-46 branch May 16, 2019 12:15
owulveryck added a commit that referenced this pull request Sep 29, 2019
* feat: skeleton for softmax

* wip: Softmax is roughly a copy/paste from Gorgonia

This should allow implementing axis!=1
By now, only the simple example is passing the tests.
The problem is related to the comment in the ONNX definition:

Input does not need to explicitly be a 2D vector; rather, it will be coerced into one. For an arbitrary n-dimensional tensor input \in [a_0, a_1, ..., a_{k-1}, a_k, ..., a_{n-1}] and k is the axis provided, then input will be coerced into a 2-dimensional tensor with dimensions [a_0 * ... * a_{k-1}, a_k * ... * a_{n-1}]. For the default case where axis=1, this means the input tensor will be coerced into a 2D tensor of dimensions [a_0, a_1 * ... * a_{n-1}], where a_0 is often the batch size. In this situation, we must have a_0 = N and a_1 * ... * a_{n-1} = D. Each of these dimensions must be matched correctly, or else the operator will throw errors.

* chore: replaced div with hadamarddiv

* test: this is a stable version of the Softmax but it still fails

* fix: if the root is nil, gracefully return an error

* fix: return an error is the node is not a tensor nor an operation

* feat: add a local test for the softmax operator
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.

1 participant