Skip to content

Rename cast/constant parameter type to dataType - #888

Merged
fdwr merged 2 commits into
webmachinelearning:mainfrom
fdwr:castTypeToDataType
Sep 15, 2025
Merged

Rename cast/constant parameter type to dataType#888
fdwr merged 2 commits into
webmachinelearning:mainfrom
fdwr:castTypeToDataType

Conversation

@fdwr

@fdwr fdwr commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator

The MLOperandDataType is named type for cast and constant but named dataType everywhere else. e.g.

- MLOperand constant(MLOperandDataType type, MLNumber value);
+ ...................MLOperandDataType dataType
- MLOperand cast(MLOperand input, MLOperandDataType type, optional MLOperatorOptions options = {});
+ ................................MLOperandDataType dataType

Other places:

dictionary MLOperandDescriptor {
  required MLOperandDataType dataType;
  ...
};

interface MLOperand {
  readonly attribute MLOperandDataType dataType;
  ...
};

interface MLTensor {
  readonly attribute MLOperandDataType dataType;
  ...
};

dictionary MLArgMinMaxOptions : MLOperatorOptions {
  ...
  MLOperandDataType outputDataType = "int32";
};

Motivation: consistency
Breakage risk: low, since parameter names rather than field or type names.


Preview | Diff

@fdwr
fdwr marked this pull request as ready for review September 15, 2025 04:56
@fdwr
fdwr requested a review from huningxin September 15, 2025 04:56

@huningxin huningxin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @fdwr !

@fdwr
fdwr merged commit d23b701 into webmachinelearning:main Sep 15, 2025
2 checks passed
github-actions Bot added a commit that referenced this pull request Sep 15, 2025
SHA: d23b701
Reason: push, by fdwr

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants