Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
KTong821 committed Feb 24, 2024
1 parent 12d404c commit 4cfe981
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
10 changes: 3 additions & 7 deletions python/hidet/drivers/build_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List, Set, Dict
from typing import List, Dict
import os
import json
import shutil
Expand All @@ -34,7 +34,7 @@ def get_graph_weights(graph):
Get the weights of the graph. All constant tensors used by the operators in the graph, or returned directly by the
graph, are considered as weights.
"""
weights: List[Tensor] = list()
weights: List[Tensor] = []
for node in graph.nodes:
for x in node.inputs:
if x.storage is not None:
Expand Down Expand Up @@ -146,12 +146,8 @@ def get_graph_meta_data(graph: FlowGraph, num_kernels, space: int) -> GraphMetaD
lines.append(str(graph))
lines.append(str(space))

# graph nodes are not traversed in deterministic order
# sort to ensure same graph --> same hash
lines.sort()

graph_hash = sha256('\n'.join(lines).encode('utf-8')).hexdigest()[:16]

return GraphMetaData(
inputs=inputs,
outputs=outputs,
Expand Down
4 changes: 1 addition & 3 deletions python/hidet/graph/impl/graph_impl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Tuple, Dict, Set, Optional, Union
from typing import List, Tuple, Dict, Optional, Union
from collections import defaultdict
import hidet.option
from hidet.graph.tensor import Tensor
Expand Down Expand Up @@ -58,8 +58,6 @@ def valid(t: Tensor) -> bool:
for ot in outputs:
if ot.trace and ot not in stop_tensors:
find_all_nodes(ot.op)
print("all_nodes")
print(all_nodes)

# topological sort
out_degree: Dict[Operator, int] = {u: 0 for u in all_nodes}
Expand Down

0 comments on commit 4cfe981

Please sign in to comment.