Skip to content

Commit

Permalink
Basic Python API for State (apache#6)
Browse files Browse the repository at this point in the history
* Add Basic Python API for State

* Add UTs for State
  • Loading branch information
jcf94 authored and merrymercy committed Jun 20, 2020
1 parent e0a5ed5 commit 359905a
Show file tree
Hide file tree
Showing 10 changed files with 1,222 additions and 84 deletions.
20 changes: 20 additions & 0 deletions python/tvm/ansor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, 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.
# pylint: disable=unused-import, redefined-builtin
"""Namespace for Ansor autoSchedule"""

from .compute_dag import ComputeDAG
21 changes: 21 additions & 0 deletions python/tvm/ansor/_ffi_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, 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.
"""FFI APIs for tvm.ansor"""
import tvm._ffi


tvm._ffi._init_api("ansor", __name__)
34 changes: 34 additions & 0 deletions python/tvm/ansor/compute_dag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, 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.
# pylint: disable=unused-import
""" ... """

import tvm._ffi
from tvm.runtime import Object

from .state import State

from . import _ffi_api


@tvm._ffi.register_object("ansor.ComputeDAG")
class ComputeDAG(Object):
def __init__(self, tensors):
self.__init_handle_by_constructor__(_ffi_api.ComputeDAG, tensors)

def get_init_state(self) -> State:
return self.init_state
Loading

0 comments on commit 359905a

Please sign in to comment.