tflite-support icon indicating copy to clipboard operation
tflite-support copied to clipboard

Added Utils for iOS Task Library Backed by C++ APIs

Open priankakariatyml opened this issue 2 years ago • 4 comments

priankakariatyml avatar Jul 25 '22 17:07 priankakariatyml

The problem with adding cpp functions into TFLCommonUtils.m is that this will become an ObjC++ .mm file. Any files that use TFLCommonUtils will also have to become ObjC++ files for this reason. Say TFLImageClassifier.m -> TFLImageClassifier.mm. Is the dependency issue because of inheritance? If so we can keep the three independent, say TFLCommonUtils, TFLCommonCppUtils and TFLCommonCUtils all inheriting from NSObject. I added inheritance so that the classes that use TFLCommonUtils don't have to import both dependencies, say Image Classifier can import TFLCommonCUtils instead of importing both TFLCommonUtills and TFLCommonCUtils. But this is not necessary, if it is causing an issue at your end. In that way files that use the C library don't need to be ObjC++ files.

priankakariatyml avatar Jul 26 '22 07:07 priankakariatyml

Acked the issue with turning the TFLCommonUtils into ObjC++ if we add the C++ code there. What about creating a new class TFLCommonCppUtils that extends TFLCommonUtils?

We can accept the trade-off that the code will not be very neat to reduce the amount of changes needed.

The problem with the current refactoring is that it caused a lot of changes across many files. When importing the code into internal repo, it leads to many unintentional changes that are very tricky to apply, due to the difference between the GitHub codebase and the internal codebase.

khanhlvg avatar Jul 26 '22 08:07 khanhlvg

Acked the issue with turning the TFLCommonUtils into ObjC++ if we add the C++ code there. What about creating a new class TFLCommonCppUtils that extends TFLCommonUtils?

We can accept the trade-off that the code will not be very neat to reduce the amount of changes needed.

The problem with the current refactoring is that it caused a lot of changes across many files. When importing the code into internal repo, it leads to many unintentional changes that are very tricky to apply, due to the difference between the GitHub codebase and the internal codebase.

Got it. I'll retain the C functions in TFLCommonUtils and extend it for Cpp. Also, I think I'll have to revert the folder structure changes.

priankakariatyml avatar Jul 26 '22 13:07 priankakariatyml

Acked the issue with turning the TFLCommonUtils into ObjC++ if we add the C++ code there. What about creating a new class TFLCommonCppUtils that extends TFLCommonUtils?

We can accept the trade-off that the code will not be very neat to reduce the amount of changes needed.

The problem with the current refactoring is that it caused a lot of changes across many files. When importing the code into internal repo, it leads to many unintentional changes that are very tricky to apply, due to the difference between the GitHub codebase and the internal codebase.

I have raised a new PR for these changes: https://github.com/tensorflow/tflite-support/pull/866

priankakariatyml avatar Jul 27 '22 12:07 priankakariatyml