Skip to content

TensorFlowScorer in ML.NET does not support input tensor of unknown shape #848

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

Closed
CESARDELATORRE opened this issue Sep 6, 2018 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@CESARDELATORRE
Copy link
Contributor

Using Microsoft.ML 0.5.0
Yael told me she's already working on a PR to fix this issue. 👍

Issue/Bug:
We’d like to extend your test case TensorFlowTransformCifarLearningPipelineTest for making a demo, but instead of loading your “cifar” frozen model, we’ll be using an inception model trained for imagenet (downloaded from https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip ).

The main issue is that when executing the Train method of the pipeline, we get an error related to the initialization of the TensorFlowScorer, which I believe is related with using an input tensor of unknown shape.

Details of the bug/issue are below, but the main question is if we’ll be able to use an input tensor of unknown shape.

var shape = tfShapes[i].ToIntArray().Skip(tfShapes[i][0] == -1 ? BatchSize : 0)

Former code is executed in the method TensorFlowMapper.GetInputMetaData(). tfShapes[i] is an object of type TFShape; if the shape is unknown, accessing by the indexer to the first dimension ( tfSfapes[i][0] ) throws a null exception. I checked that most of the methods in TFShape have a guard condition on dims == null, but the overridden indexer doesn’t have this guard, what could be the culprit of the NullReferenceException

But even if you fix the indexer, then the method tfShapes[i].ToIntArray() it will return null for an unknown tensor, so this will throw again an exception.

Full source code of the demo (and the crash) is available here:
https://github.com/CESARDELATORRE/TensorFlowMLNETSamples/blob/master/src/TensorFlowMLNETInceptionv3ModelScoring/Program.cs

@CESARDELATORRE CESARDELATORRE added the bug Something isn't working label Sep 6, 2018
@yaeldekel yaeldekel self-assigned this Sep 10, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants