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

[TFLite] Cast operator adapted for MLIR-based convertor #7639

Merged
merged 2 commits into from
Mar 19, 2021

Conversation

d-smirnov
Copy link
Contributor

Cast operator now can be executed in MLIR-based version.
Unit test updated

cast_options.Init(op_options.Bytes, op_options.Pos)
cast_dtype = cast_options.OutDataType()
else:
cast_dtype = self.get_output_tensors(op)[0].tensor.Type()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because the cast operator can be in 2 forms, one with the type specified by BuiltinOptions.CastOptions and the other type is where there is no output data type specified by BuiltinOptions.CastOptions but we can derive the output type of the cast operator based on the type of the output tensor for the Cast operator itself ?

Is that worth stating in the commit message or in a comment ?

Ramana

@u99127
Copy link
Contributor

u99127 commented Mar 12, 2021

@anijain2305 @FrozenGene - could you please help review ?

@anijain2305
Copy link
Contributor

LGTM, please add a comment as Ramana suggested.

@d-smirnov
Copy link
Contributor Author

@u99127 @anijain2305
MLIR-based converter outputs no BuiltinOptions for Cast operator. In this case the output type can be derived from the Cast operator output tensor, In case of TOCO converter there will be "normal" BuiltinOptions.CastOptions with output type. The PR allows both versions of Cast to be consumed with TFLite front end.

@u99127
Copy link
Contributor

u99127 commented Mar 16, 2021

@u99127 @anijain2305
MLIR-based converter outputs no BuiltinOptions for Cast operator. In this case the output type can be derived from the Cast operator output tensor, In case of TOCO converter there will be "normal" BuiltinOptions.CastOptions with output type. The PR allows both versions of Cast to be consumed with TFLite front end.

Ok, please document this as a comment in the source.

Ramana

@d-smirnov
Copy link
Contributor Author

@u99127 Added comment to the source file

Copy link
Contributor

@u99127 u99127 left a comment

Choose a reason for hiding this comment

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

LGTM, but I cannot approve or merge.

@anijain2305 ?

Ramana

@anijain2305
Copy link
Contributor

@d-smirnov Can you please check the CI error? I will merge when it passes. Assinging to myself.

@anijain2305 anijain2305 self-assigned this Mar 18, 2021
Cast operator now can be executed in MLIR-based version.
Unit test updated

Change-Id: I30e5c1c9d69355116b560af8f6d0582b2d593538
Change-Id: I3e2d29ef201283de337168d0b82679b63ca2fcf4
@anijain2305
Copy link
Contributor

Thanks @d-smirnov @u99127

AndrewZhaoLuo pushed a commit to AndrewZhaoLuo/tvm that referenced this pull request Mar 22, 2021
* main:
  [AutoScheduler] Add function name in message (apache#7703)
  [Vulkan] Workaround for zero size allocation (apache#7691)
  Change behavior of onnx importer to throw when user provides an input no in the graph. (apache#7699)
  Free TensorRT engine and context (apache#7702)
  [TFLite] Cast operator adapted for MLIR-based convertor (apache#7639)
  [CPP_RPC] allow user supplied work dir (apache#7670)
  Default value for graph_runtime Init lookup_linked_param_func (apache#7676)
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request May 6, 2021
* [TFLite] Cast operator adapted for MLIR-based convertor

Cast operator now can be executed in MLIR-based version.
Unit test updated

Change-Id: I30e5c1c9d69355116b560af8f6d0582b2d593538

* Comment added

Change-Id: I3e2d29ef201283de337168d0b82679b63ca2fcf4
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request May 11, 2021
* [TFLite] Cast operator adapted for MLIR-based convertor

Cast operator now can be executed in MLIR-based version.
Unit test updated

Change-Id: I30e5c1c9d69355116b560af8f6d0582b2d593538

* Comment added

Change-Id: I3e2d29ef201283de337168d0b82679b63ca2fcf4
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.

3 participants