Skip to content

Commit 9527a73

Browse files
Add notes regarding label usage, provided by i18n review (#841)
As suggested by @xfq, add additional details about operator labels, clarifying that they are not intended to be natural language strings. And include an advisement that use of developer-provided labels is subject to spoofing, and implementations should sanitize them. Co-authored-by: Anssi Kostiainen <[email protected]>
1 parent 9c6bb5b commit 9527a73

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

index.bs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,6 @@ A key part of the {{MLGraphBuilder}} interface are methods such as {{MLGraphBuil
701701

702702
An [=operator=] has a <dfn for=operator>label</dfn>, a string which may be included in diagnostics such as [=exception=] messages. When an [=operator=] is created its [=operator/label=] is initialized in an [=implementation-defined=] manner and may include the passed {{MLOperatorOptions/label}}.
703703

704-
Note: Implementations are encouraged to use the {{MLOperatorOptions/label}} provided by developers to enhance error messages and improve debuggability, including both synchronous errors during graph construction and for errors that occur during the asynchronous {{MLGraphBuilder/build()}} method.
705-
706704
ISSUE(778): Consider adding a mechanism for reporting errors during {{MLContext/dispatch()}}.
707705

708706
At inference time, every {{MLOperand}} will be bound to a tensor (the actual data), which are essentially multidimensional arrays. The representation of the tensors is implementation dependent, but it typically includes the array data stored in some buffer (memory) and some metadata describing the array data (such as its shape).
@@ -1575,6 +1573,12 @@ Implementations may impose a more restricted lower bound and/or upper bound on t
15751573
Optionally provided when an [=operator=] is created using {{MLGraphBuilder}} methods that create {{MLOperand}}s. The implementation may use this value to initialize the [=operator=]'s [=operator/label=].
15761574
</dl>
15771575

1576+
Note: The label is not intended to be a natural language string. It is a language-independent identifier, analogous to a variable name or error code, like `"mul#1234"`.
1577+
1578+
Note: Implementations are encouraged to use the {{MLOperatorOptions/label}} provided by developers to enhance error messages and improve debuggability, including both synchronous errors during graph construction and for errors that occur during the asynchronous {{MLGraphBuilder/build()}} method.
1579+
1580+
Advisement: When displaying labels provided by developers via {{MLOperatorOptions/label}} in debugging tools, logs, or error messages, implementations should sanitize the output to prevent security risks, such as injection of malicious Unicode sequences (e.g. <a href="https://www.unicode.org/reports/tr36/#Bidirectional_Text_Spoofing">Bidirectional Text Spoofing</a> [[UTR36]], <a href="https://www.unicode.org/reports/tr55/tr55-5.html#Spoofing">Source Code Spoofing</a> [[UTS55]] and other concerns). For example, implementations should escape or filter control characters (e.g., U+202A to U+202E, U+2066 to U+2069) or use a safe rendering mechanism to neutralize potential spoofing.
1581+
15781582
### Creating an {{MLOperand}} ### {#api-mloperand-create}
15791583
The {{MLOperand}} objects are created by the methods of {{MLGraphBuilder}}, internally using the following algorithms.
15801584

@@ -10309,6 +10313,8 @@ Thanks to Jiewei Qian for Chromium implementation review and feedback.
1030910313
Thanks to Dwayne Robinson, Joshua Lochner and Wanming Lin for their work investigating and providing recommendation for transformer support. Additional thanks to Dwayne and Wanming for providing reviews of operator conformance and web-platform-tests implementation.
1031010314

1031110315
Thanks to Feng Dai for his continuous contributions that keep web-platform-tests evolving alongside the specification.
10316+
10317+
Thanks to Fuqiao Xue and the W3C Internationalization Activity for reviews and suggestions.
1031210318
<pre class="biblio">
1031310319
{
1031410320
"Models": {

0 commit comments

Comments
 (0)