Skip to content

Commit ff0ca78

Browse files
committed
fix lint
1 parent 5f11005 commit ff0ca78

File tree

21 files changed

+309
-158
lines changed

21 files changed

+309
-158
lines changed

include/tvm/relay/op_attr_types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ class OpImplement : public ObjectRef {
268268
* \param target The build target.
269269
* \return The computation schedule.
270270
*/
271-
Schedule Schedule(const Attrs& attrs,
272-
const Array<Tensor>& outs,
273-
const Target& target);
271+
tvm::Schedule Schedule(const Attrs& attrs,
272+
const Array<Tensor>& outs,
273+
const Target& target);
274274
};
275275

276276
/*!

include/tvm/schedule.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,11 +744,17 @@ class SingletonNode : public IterVarRelationNode {
744744

745745
class SpecializedConditionNode;
746746

747+
/*!
748+
* \brief Specialized condition to enable op specialization
749+
*/
747750
class SpecializedCondition : public ObjectRef {
748751
public:
749752
SpecializedCondition() {}
750753
explicit SpecializedCondition(ObjectPtr<Object> n) : ObjectRef(n) {}
751-
754+
/*!
755+
* \brief Get the current specialized condition.
756+
* \return The current specialized condition.
757+
*/
752758
TVM_DLL static tvm::SpecializedCondition Current();
753759

754760
const SpecializedConditionNode* operator->() const;
@@ -759,14 +765,20 @@ class SpecializedCondition : public ObjectRef {
759765
// enable with syntax.
760766
friend class Internal;
761767
friend class With<SpecializedCondition>;
762-
768+
/*! \brief Push a new specialized condition onto the thread local stack. */
763769
TVM_DLL void EnterWithScope();
764-
770+
/*! \brief Pop a specialized condition off the thread local context stack. */
765771
TVM_DLL void ExitWithScope();
766772
};
767773

774+
/*! \brief Container for specialization conditions. */
768775
class SpecializedConditionNode : public Object {
769776
public:
777+
/*!
778+
* \brief List of conditions in conjunctive joint form (CNF).
779+
* Each condition should be a simple expression, e.g., n > 16, m % 8 == 0, etc.,
780+
* where n, m are tvm::Var that represents a dimension in the tensor shape.
781+
*/
770782
Array<Expr> clauses;
771783

772784
void VisitAttrs(AttrVisitor* v) {

python/tvm/autotvm/graph_tuner/base_graph_tuner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import tvm
2626
from tvm import autotvm, relay
2727
from tvm.autotvm.task import get_config
28-
from tvm.autotvm.task.topi_integration import deserialize_args, serialize_args
28+
from tvm.autotvm.task.topi_integration import serialize_args
2929
from tvm.autotvm.record import encode, load_from_file
3030
from tvm.autotvm.measure import MeasureResult, MeasureInput
3131

@@ -50,11 +50,9 @@ def get_infer_layout(task_name):
5050
else:
5151
raise ValueError("Cannot find infer layout for task %s" % task_name)
5252

53-
#@autotvm.template
5453
@autotvm.register_customized_task("layout_transform")
5554
def layout_transform(*args):
5655
"""Autotvm layout transform template."""
57-
args = deserialize_args(args)
5856
cfg = get_config()
5957
cfg.add_flop(-1)
6058
data = args[0]

python/tvm/autotvm/record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import json
2727
import time
2828
import os
29-
import numpy as np
3029
import itertools
3130
from collections import OrderedDict
31+
import numpy as np
3232

3333
from .. import build, lower, target as _target
3434

python/tvm/autotvm/task/dispatcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def _query_inside(self, target, workload):
335335
if key in self._best_user_defined:
336336
return self._best_user_defined[key]
337337
if key in self.best_by_model:
338-
inp, res = self.best_by_model[key]
338+
inp, _ = self.best_by_model[key]
339339
return inp.config
340340

341341
# then try matching by target key
@@ -344,7 +344,7 @@ def _query_inside(self, target, workload):
344344
if key in self._best_user_defined:
345345
return self._best_user_defined[key]
346346
if key in self.best_by_targetkey:
347-
inp, res = self.best_by_targetkey[key]
347+
inp, _ = self.best_by_targetkey[key]
348348
return inp.config
349349

350350
return None

python/tvm/relay/backend/compile_engine.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@
2929
from .. import expr as _expr
3030
from .. import op as _op
3131
from .. import ty as _ty
32-
from ..expr_functor import ExprFunctor
32+
from ..expr_functor import ExprVisitor
3333
from . import _backend
3434

3535
@register_relay_node
3636
class CachedFunc(NodeBase):
3737
"""Low-level tensor function to back a relay primitive function.
3838
"""
3939
def __init__(self, target, func_name, inputs, outputs, schedule=None,
40-
lowered_funcs=[], shape_func_param_states=[]):
40+
lowered_funcs=None, shape_func_param_states=None):
41+
if lowered_funcs is None:
42+
lowered_funcs = []
43+
if shape_func_param_states is None:
44+
shape_func_param_states = []
4145
self.__init_handle_by_constructor__(
4246
_backend._make_CachedFunc, target, func_name, inputs, outputs,
4347
schedule, lowered_funcs, shape_func_param_states)
@@ -79,6 +83,7 @@ def _get_cache_key(source_func, target):
7983

8084

8185
def get_shape(shape):
86+
"""Convert the shape to correct dtype and vars."""
8287
ret = []
8388
for dim in shape:
8489
if isinstance(dim, tvm.expr.IntImm):
@@ -92,7 +97,9 @@ def get_shape(shape):
9297
return ret
9398

9499

95-
class ScheduleGetter(ExprFunctor):
100+
class ScheduleGetter(ExprVisitor):
101+
"""Get the schedule given a fused Relay function"""
102+
96103
MAX_FUNC_NAME_LENGTH = 80
97104

98105
def __init__(self, target):

python/tvm/relay/op/_reduce.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
"""Backend compiler related feature registration"""
1818
from __future__ import absolute_import
1919

20-
import topi
21-
2220
from topi.util import get_const_int, get_const_tuple
2321
from . import op as _reg
2422
from ...api import convert

python/tvm/relay/op/contrib/_contrib.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"""Backend compiler related feature registration"""
1919
from __future__ import absolute_import
2020

21-
import topi
2221
from .. import op as reg
2322
from .. import strategy
2423
from ..op import OpPattern

python/tvm/relay/op/op.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17-
#pylint: disable=unused-argument
17+
#pylint: disable=unused-argument,invalid-name
1818
"""The base node types for the Relay language."""
19-
import topi
20-
2119
from ..._ffi.function import _init_api
2220

2321
from ..base import register_relay_node

python/tvm/relay/op/strategy/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# pylint: disable=wildcard-import
19+
"""Relay op strategies."""
20+
from __future__ import absolute_import as _abs
21+
122
from .generic import *
223
from . import x86
324
from . import arm_cpu

0 commit comments

Comments
 (0)