Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Static Shape Mismatch Checking: Any examples? #260

Closed
huan opened this issue Aug 29, 2019 · 7 comments
Closed

Static Shape Mismatch Checking: Any examples? #260

huan opened this issue Aug 29, 2019 · 7 comments

Comments

@huan
Copy link

huan commented Aug 29, 2019

Hello,

I'm an ML GDE who is working with @snowkylin and contributing the Swift for Tensorflow chapter for our book Tensorflow 2.0 Handbook which plan to be published right after the TF2.0 released.

I'm very interested in the following design goals and I thought we have already supported them, for example, the shape mismatch checking in the compile time.

However, I did not find any more information or examples after I had a hard search via Google & Github. Is there any discussion for the static shape mismatch checking, or for better, any examples?

Thanks!

BTW: I had created an MNIST Swift Module at here for use this dataset with ease.

A system that diagnoses more errors earlier (e.g. shape mismatches at compile time) is more useful than one that only catches them at run time.
https://github.com/tensorflow/swift/blob/master/docs/WhySwiftForTensorFlow.md


Shape Checking: Shape errors are an ongoing problem for machine learning research and productivity. We already have some basic shape checks from the TensorFlow graph building APIs, but we need to invest in first-class support for this to produce better diagnostics and diagnose more errors at high-level API boundaries instead of inside the implementation of those APIs. We have initial ideas of how this could work but need to explore this much further.
Named Dimensions: A frequently requested feature is to be able to use symbolic dimension names in Tensors. There are several different possible models that could be explored here.

-- https://github.com/tensorflow/swift/blob/master/docs/DesignOverview.md

@saeta
Copy link
Contributor

saeta commented Aug 29, 2019

Hi @huan !

Thanks for reaching out. This is an excellent question and one I'm happy to say we've been actively working on. Since we started (when WhySwiftForTensorFlow.md was written) we have been iterating on our design of the whole system from top-to-bottom. As a result, some of the original thoughts for how we'd implement static shape checking have changed. Fortunately, @apaszke-g is actively working on a new approach for this problem, and I expect he will talk about his work once it gets a little bit more mature at a forthcoming open design review. (Join [email protected] to get all the details.) Questions and comments for (and during) the design review are much appreciated! :-)

All the best,
-Brennan

@BradLarson
Copy link
Contributor

Also, in regards to MNIST, we recently restructured tensorflow/swift-models to pull out datasets and be able to reuse them across models and examples. One of these datasets is MNIST, but the current implementation has some known problems.

If you'd want to pull in your implementation of MNIST and integrate it with the models there, we'd be glad to have it.

@huan
Copy link
Author

huan commented Aug 29, 2019

@saeta Thanks for letting me know we have been actively working on this feature and the email list.

The static shape checking is the feature that most excited me, I'm looking forward to reading the open design review from @apaszke-g.

@huan
Copy link
Author

huan commented Aug 29, 2019

@BradLarson I would love to contribute on the Swift models repository, and it seems that my MNIST module borrowed lots of the code from the swift-models, and also download the data files from that repository. (I get the code from another Colab notebook the day before yesterday).

What are the known problems for the current implementation, is there any issue for them?

@BradLarson
Copy link
Contributor

@huan - One big problem is that the current MNIST implementation in the repository lacks shuffling for the batches. The CIFAR10 dataset example has this, for example. Another is that it currently relies on hardcoded paths, which will break if you take the dataset outside of that project and try to use it in something like Colab.

Also, there isn't a consistent API in the image classification datasets we have so far, so it would be nice to align the CIFAR10 and MNIST datasets such that they could be closer in that regard. I don't know how much we want to develop here (vs. in a framework like SwiftAI), but maybe there could be a protocol that image classification datasets could comply to.

@huan
Copy link
Author

huan commented Aug 30, 2019

@BradLarson Got it. I had created another issue at tensorflow/swift-models#206 and let's move there to continue discussing.

@dan-zheng
Copy link
Member

Hi @huan,

You may be interested in https://github.com/google-research/swift-tfp - it's a project for static shape checking for Swift for TensorFlow.

It seems tensorflow/swift-models#206 has been closed, so I'll close this issue now as well.

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

No branches or pull requests

4 participants