[llvm] b72e893 - [mlgo] Fix type annotation in log_reader, for older python3 versions
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 3 18:04:26 PST 2023
Author: Mircea Trofin
Date: 2023-02-03T18:04:09-08:00
New Revision: b72e893d1d8e198f8f1674c393d27e07423c377e
URL: https://github.com/llvm/llvm-project/commit/b72e893d1d8e198f8f1674c393d27e07423c377e
DIFF: https://github.com/llvm/llvm-project/commit/b72e893d1d8e198f8f1674c393d27e07423c377e.diff
LOG: [mlgo] Fix type annotation in log_reader, for older python3 versions
Added:
Modified:
llvm/lib/Analysis/models/log_reader.py
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/models/log_reader.py b/llvm/lib/Analysis/models/log_reader.py
index 0fe090cb32ae..7278b1f5e46e 100644
--- a/llvm/lib/Analysis/models/log_reader.py
+++ b/llvm/lib/Analysis/models/log_reader.py
@@ -8,7 +8,7 @@
import json
import math
import sys
-from typing import Optional
+from typing import List, Optional
_element_types = {
'float': ctypes.c_float,
@@ -28,7 +28,7 @@
class TensorSpec:
name: str
port: int
- shape: list[int]
+ shape: List[int]
element_type: type
@staticmethod
@@ -89,7 +89,7 @@ def read_header(f: io.BufferedReader):
def read_one_observation(context: Optional[str],
event_str: str,
f: io.BufferedReader,
- tensor_specs: list[TensorSpec],
+ tensor_specs: List[TensorSpec],
score_spec: Optional[TensorSpec]):
event = json.loads(event_str)
if 'context' in event:
More information about the llvm-commits
mailing list