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

[MachineLearning.Inference] Add MlInformation and MlInformationList #6519

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

niley7464
Copy link
Contributor

@niley7464 niley7464 commented Dec 17, 2024

This patch newly adds the MlInformation and MlInformationList class. These class manages information based on key-value.

Description of Change

Added:

  • MlInformation
    • SetString
    • SetInteger
    • GetString
    • GetInteger
    • GetTensorsData
  • MlInformationList
    • GetInformation
    • GetLength

API Changes

@github-actions github-actions bot added the API13 label Dec 17, 2024
@TizenAPI-Bot
Copy link
Collaborator

Public API Changed

Please follow the ACR process for the changed API below.

Added: 16, Removed: 0, Changed: 0

Added

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformation::GetNumber(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.String Tizen.MachineLearning.Inference.MlInformation::GetString(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::.ctor()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetNumber(System.String,System.Int32)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetString(System.String,System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.TensorsData Tizen.MachineLearning.Inference.MlInformation::GetTensorsData(System.String)

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformationList

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformationList::GetLength()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation Tizen.MachineLearning.Inference.MlInformationList::GetInformation(System.Int32)

/// Gets a int value of key in MlInformation instance.
/// </summary>
/// <param name="key">The key to be set.</param>
/// <returns>The string value of the key.</returns>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion:
description: The integer value of the key.
method name: GetNumber/SetNumber -> GetInteger / SetInteger ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated description and method name :)

}

/// <summary>
/// Gets a int value of key in MlInformation instance.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Gets an int value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated 👍

/// <summary>
/// Gets a string value of key in MlInformation instance.
/// </summary>
/// <param name="key">The key to be set.</param>
Copy link
Contributor

Choose a reason for hiding this comment

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

231 and 248
The key to get the corresponding value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated 👍

}

/// <summary>
/// Creates a MlInformation instance from Native handle.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: from Native handle -> from native handle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated 👍

break;
case InfoType.Information:
ret = NNStreamerError.NotSupported;
Log.Error(NNStreamer.TAG, "InfoType Iniformation does not support set value");
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Iniformation -> Information

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated 👍

break;
}

NNStreamer.CheckException(ret, "Failed to set string value");
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: set string value -> set integer value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed it :)

@niley7464 niley7464 force-pushed the inference/information branch from 4bb38a7 to 644f08b Compare December 19, 2024 05:07
@TizenAPI-Bot
Copy link
Collaborator

Public API Changed

Please follow the ACR process for the changed API below.

Added: 16, Removed: 0, Changed: 0

Added

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformation::GetInteger(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.String Tizen.MachineLearning.Inference.MlInformation::GetString(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::.ctor()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetInteger(System.String,System.Int32)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetString(System.String,System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.TensorsData Tizen.MachineLearning.Inference.MlInformation::GetTensorsData(System.String)

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformationList

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformationList::GetLength()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation Tizen.MachineLearning.Inference.MlInformationList::GetInformation(System.Int32)

NNStreamer.CheckException(ret, "Failed to set integer value");
}

private IntPtr GetInformationHandle(string key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion:
method name GetInformationHandle > GetValue

line 223, 240, 257, 276
error message "information handle from key" > "value of key from information handle"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed method name and updated error message :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@again4you
After reviewing with Sangjung, let's start ACR :)

/// <feature>http://tizen.org/feature/machine_learning.inference</feature>
/// <exception cref="ArgumentException">Thrown when the method failed due to an invalid parameter.</exception>
/// <since_tizen> 13 </since_tizen>
public string GetString(string key)
Copy link
Contributor

@jaeyun-jung jaeyun-jung Dec 19, 2024

Choose a reason for hiding this comment

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

line 236, 253, 270 add exception 'not-supported' (GetInformationHandle() may raise an exception for this.)

/// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added not-supported exception 👍

/// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
/// </summary>
/// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
protected virtual void Dispose(bool disposing)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is /// <since_tizen> 13 </since_tizen> necessary?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, unnecessary.

@niley7464 niley7464 force-pushed the inference/information branch from 644f08b to 3266233 Compare December 19, 2024 10:00
@TizenAPI-Bot
Copy link
Collaborator

Public API Changed

Please follow the ACR process for the changed API below.

Added: 16, Removed: 0, Changed: 0

Added

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformation::GetInteger(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.String Tizen.MachineLearning.Inference.MlInformation::GetString(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::.ctor()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetInteger(System.String,System.Int32)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetString(System.String,System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.TensorsData Tizen.MachineLearning.Inference.MlInformation::GetTensorsData(System.String)

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformationList

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformationList::GetLength()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation Tizen.MachineLearning.Inference.MlInformationList::GetInformation(System.Int32)

@niley7464 niley7464 force-pushed the inference/information branch from 3266233 to 6eee932 Compare December 19, 2024 10:07
@TizenAPI-Bot
Copy link
Collaborator

Public API Changed

Please follow the ACR process for the changed API below.

Added: 16, Removed: 0, Changed: 0

Added

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformation::GetInteger(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.String Tizen.MachineLearning.Inference.MlInformation::GetString(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::.ctor()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetInteger(System.String,System.Int32)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetString(System.String,System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.TensorsData Tizen.MachineLearning.Inference.MlInformation::GetTensorsData(System.String)

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformationList

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformationList::GetLength()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation Tizen.MachineLearning.Inference.MlInformationList::GetInformation(System.Int32)

/// </summary>
/// <param name="key">The key to be set.</param>
/// <param name="value">The value to be set.</param>
/// <feature>http://tizen.org/feature/machine_learning.inference</feature>
Copy link
Contributor

Choose a reason for hiding this comment

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

In the case of ml_inofrmation_*, it will be used in ml-service (and training?) later.
How about implementing these as a common part?

Tizen.MachineLearning or Tizen.MachineLearning.Common feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tizen.MachineLearning.Inference must be included to use MlInformation.GetTensorsData.
So how about using Tizen.MachineLearning.Inference namespace like any other common part so that user don't have to declare multiple namespaces?

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, let's use the Tizen.MachineLearning.Inference namespace now. Consider separating them to common parts when it becomes necessary later.

/// Creates a MlInformationList instance.
/// </summary>
/// <feature>http://tizen.org/feature/machine_learning.inference</feature>
/// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check the exception here and below.
I think in this case ArgumentException.

Suggested change
/// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
/// <exception cref="ArgumentException">Thrown when the method failed due to an invalid parameter.</exception>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added ArgumentException
Thank you :)

This patch newly adds the MlInformation and MlInformationList class.
These class manages information based on key-value.

Added:
- MlInformation
- MlInformationList

Signed-off-by: Yelin Jeong <[email protected]>
@niley7464 niley7464 force-pushed the inference/information branch from 6eee932 to 679f597 Compare December 20, 2024 01:07
@TizenAPI-Bot
Copy link
Collaborator

Public API Changed

Please follow the ACR process for the changed API below.

Added: 16, Removed: 0, Changed: 0

Added

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformation::GetInteger(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.String Tizen.MachineLearning.Inference.MlInformation::GetString(System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::.ctor()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetInteger(System.String,System.Int32)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformation::SetString(System.String,System.String)

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.TensorsData Tizen.MachineLearning.Inference.MlInformation::GetTensorsData(System.String)

+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformationList

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ System.Int32 Tizen.MachineLearning.Inference.MlInformationList::GetLength()

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose()

+ /// <since_tizen>none</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Dispose(System.Boolean)

+ /// <since_tizen>13</since_tizen
+ System.Void Tizen.MachineLearning.Inference.MlInformationList::Finalize()

+ /// <privilege>http://tizen.org/feature/machine_learning.inference</privilege
+ /// <since_tizen>13</since_tizen
+ Tizen.MachineLearning.Inference.MlInformation Tizen.MachineLearning.Inference.MlInformationList::GetInformation(System.Int32)

Copy link
Contributor

@gichan-jang gichan-jang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@again4you again4you left a comment

Choose a reason for hiding this comment

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

Ready to go! Good Job!

Copy link
Contributor

@songgot songgot left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

6 participants