Skip to content

Commit 3fe2425

Browse files
Add notes regarding label usage, provided by i18n review
A 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.
1 parent 24a8097 commit 3fe2425

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.bs

+4
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,12 @@ 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: 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"`.
705+
704706
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.
705707

708+
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., bidirectional control characters as described in Unicode Technical Report #36, Trojan Source attacks). 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.
709+
706710
ISSUE(778): Consider adding a mechanism for reporting errors during {{MLContext/dispatch()}}.
707711

708712
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).

0 commit comments

Comments
 (0)