mirror of https://github.com/commaai/tinygrad.git
cleanups, remove E701
This commit is contained in:
parent
b65b70812a
commit
ef62db3186
|
@ -39,7 +39,7 @@ jobs:
|
|||
- name: Lint with pylint
|
||||
run: python -m pylint --disable=all -e W0311 --jobs=0 --indent-string=' ' **/*.py
|
||||
- name: Lint with flake8
|
||||
run: flake8 tinygrad/ --indent-size=2 --select=F,E112,E113,E304,E502,E701,E702,E703,E71,E72,E731,W191,W6 --statistics -j4
|
||||
run: flake8 tinygrad/ --indent-size=2 --select=F,E112,E113,E304,E502,E702,E703,E71,E72,E731,W191,W6 --statistics -j4
|
||||
- name: Lint tinygrad with pylint
|
||||
run: pylint tinygrad/
|
||||
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
from ast import Assert
|
||||
import pathlib, sys
|
||||
import os, time, io, pathlib, sys
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).parent.parent))
|
||||
from collections import defaultdict
|
||||
import pyopencl as cl
|
||||
|
||||
import os
|
||||
import time
|
||||
import io
|
||||
ALLOWED_KERNEL_COUNT = int(os.getenv("ALLOWED_KERNEL_COUNT", 0))
|
||||
|
||||
os.environ['OPT'] = '99'
|
||||
if os.getenv("GPU", None) is None:
|
||||
os.environ['OPENCL'] = '1'
|
||||
|
||||
ALLOWED_KERNEL_COUNT = int(os.getenv("ALLOWED_KERNEL_COUNT", 0))
|
||||
DEBUGCL = int(os.getenv("DEBUGCL", 0))
|
||||
|
||||
import onnx
|
||||
|
@ -21,11 +14,10 @@ import numpy as np
|
|||
|
||||
import tinygrad.lazy as lazy
|
||||
|
||||
from tinygrad.llops.ops_gpu import CL, CLProgram, CLBuffer
|
||||
from tinygrad.llops.ops_gpu import CL
|
||||
from extra.utils import fetch
|
||||
from extra.onnx import get_run_onnx
|
||||
from tinygrad.tensor import Tensor
|
||||
from tinygrad.helpers import prod
|
||||
|
||||
OPENPILOT_MODEL = "https://github.com/commaai/openpilot/raw/6c5693e965b9c63f8678f52b9e9b5abe35f23feb/selfdrive/modeld/models/supercombo.onnx"
|
||||
|
||||
|
|
|
@ -243,16 +243,11 @@ class LazyBuffer:
|
|||
arg = tuple(copy(arg))
|
||||
|
||||
# instant nops
|
||||
if op in [MovementOps.RESHAPE, MovementOps.EXPAND] and arg == self.shape:
|
||||
return self
|
||||
if op == MovementOps.PERMUTE and arg == tuple(range(len(self.shape))):
|
||||
return self
|
||||
if op == MovementOps.SHRINK and arg == tuple((0,i) for i in self.shape):
|
||||
return self
|
||||
if op == MovementOps.PAD and arg == tuple((0,0) for _ in self.shape):
|
||||
return self
|
||||
if op == MovementOps.FLIP and all(s == 1 or i not in arg for i,s in enumerate(self.shape)):
|
||||
return self
|
||||
if op in [MovementOps.RESHAPE, MovementOps.EXPAND] and arg == self.shape: return self
|
||||
if op == MovementOps.PERMUTE and arg == tuple(range(len(self.shape))): return self
|
||||
if op == MovementOps.SHRINK and arg == tuple((0,i) for i in self.shape): return self
|
||||
if op == MovementOps.PAD and arg == tuple((0,0) for _ in self.shape): return self
|
||||
if op == MovementOps.FLIP and all(s == 1 or i not in arg for i,s in enumerate(self.shape)): return self
|
||||
|
||||
# two ops in a row is one op
|
||||
if op in [MovementOps.RESHAPE, MovementOps.EXPAND, MovementOps.SHRINK] and self.realized is None and self.op.op == op:
|
||||
|
|
Loading…
Reference in New Issue