FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Created TensorFormat enum by sevarac · Pull Request #191 · tensorflow/java · GitHub

Created TensorFormat enum - #191

Open
sevarac wants to merge 1 commit into
tensorflow:masterfrom
sevarac:master
Open

Created TensorFormat enum#191
sevarac wants to merge 1 commit into
tensorflow:masterfrom
sevarac:master

Conversation

sevarac commented Jan 22, 2021

Copy link
Copy Markdown

Created enum for TensorFormat. Some additional enum values are open for discussion, at the moment there are values that are used by Tensorflow and cuDnn

google-cla Bot commented Jan 22, 2021

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Copy link
Copy Markdown
Collaborator

I don't think we can look at PRs until the CLA has been signed, so that's what this is waiting on.

sevarac commented Feb 1, 2021 via email

Copy link
Copy Markdown
Author

JimClarke5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is there a reason we shouldn't add the other four enums as described in the link?

  • CHWN 4d tensor description
  • NCDHW 5d tensor description
  • NDHWC
  • CDHWN

sevarac commented Feb 4, 2021

Copy link
Copy Markdown
Author

The main question is are they are used by tensorflow at all? Maybe someone from Tensorflow team could answer this.
I've found these layouts in cuDNN documentation so there is good chance that they are used.
It would be best to add them too if they are used, otherwise not sure if it makes sense to add them

@@ -0,0 +1,30 @@
package org.tensorflow.ndarray.buffer.layout;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @sevarac , as we discussed briefly during our last session, this enum should probably be moved at the tensorflow-core-api or tensorflow-framework level. It would be helpful to know which one if you can provide some quick examples of usage. I think @JimClarke5 had some in mind too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sounds good, in general everywhere where public Options dataFormat(String dataFormat) is used
there should be now public Options dataFormat(TensorFormat dataFormat)
which includes a bunch of classes mainly layers https://github.com/tensorflow/java/search?q=dataFormat

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It is used in losses.Losses for losses.CategoricalCrossentropy and metrics.CategoricalCrossentropy.

  public static final int CHANNELS_LAST = -1;
  public static final int CHANNELS_FIRST = 1;

Once this PR is merged, I'll change the logic in losses and metrics.

karllessard Feb 16, 2021
edited
Loading

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This could be done in the C++ op generator, by looking at any argument called dataFormat. Though I don't think this naming convention is enforced to the kernel developers, which might lead to mistakes. But there will be possible workarounds so I'm fine if you want to give a try making that change as well

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hi @sevarac , so any chance that you can move this enum to a different location, as I've suggested before?

If I need to pick one, I'll suggesttensorflow-framework over tensorflow-core-api, what about under org.tensorflow.framework.utils?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Also please don't forget to add the header notice in your file (like this one, for example).

Copy link
Copy Markdown
Contributor

BTW: I will also need this in layers.

@@ -0,0 +1,30 @@
package org.tensorflow.ndarray.buffer.layout;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Also please don't forget to add the header notice in your file (like this one, for example).

JimClarke5 mentioned this pull request May 6, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

5 participants


Back | FazBrowse Home | New Git URL