chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed 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.
|
||||
|
||||
DataType = __builtin__DataType # noqa: F821
|
||||
DataValue = __builtin__DataValue # noqa: F821
|
||||
PointerType = __builtin__PointerType # noqa: F821
|
||||
PointerValue = __builtin__PointerValue # noqa: F821
|
||||
MutableList = __builtin__MutableList # noqa: F821
|
||||
OrderedDict = __builtin__OrderedDict # noqa: F821
|
||||
MutableOrderedDict = __builtin__MutableOrderedDict # noqa: F821
|
||||
AttrMap = __builtin__AttrMap # noqa: F821
|
||||
SerializableAttrMap = __builtin__BuiltinSerializableAttrMap # noqa: F821
|
||||
|
||||
_raise = __builtin__raise # noqa: F821
|
||||
|
||||
foreach = __builtin__foreach # noqa: F821
|
||||
range = __builtin__range # noqa: F821
|
||||
map = __builtin__map # noqa: F821
|
||||
reduce = __builtin__reduce # noqa: F821
|
||||
filter = __builtin__filter # noqa: F821
|
||||
zip = __builtin__zip # noqa: F821
|
||||
flat_map = __builtin__flat_map # noqa: F821
|
||||
apply = __builtin__apply # noqa: F821
|
||||
replace_or_trim_left_comma = __builtin__replace_or_trim_left_comma # noqa: F821
|
||||
|
||||
sorted = __builtin__sorted # noqa: F821
|
||||
|
||||
dirname = __builtin__dirname # noqa: F821
|
||||
basename = __builtin__basename # noqa: F821
|
||||
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed 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.
|
||||
|
||||
import __builtin__
|
||||
|
||||
|
||||
class RegistryEntry:
|
||||
def __init__(self):
|
||||
self.__tag_name__ = None
|
||||
self.__nice__ = None
|
||||
self.__values__ = __builtin__.MutableList()
|
||||
self.__child_register_item_name2value__ = (
|
||||
__builtin__.MutableOrderedDict()
|
||||
)
|
||||
|
||||
# tag_name: str
|
||||
# nice: int
|
||||
def __getattr__(self, attrname):
|
||||
def contains():
|
||||
return self.__child_register_item_name2value__.contains(attrname)
|
||||
|
||||
def find():
|
||||
return self.__child_register_item_name2value__[attrname]
|
||||
|
||||
def create():
|
||||
register_entry = RegistryEntry()
|
||||
self.__child_register_item_name2value__[attrname] = register_entry
|
||||
return register_entry
|
||||
|
||||
return find() if contains() else create()
|
||||
|
||||
def __call__(self, tag_name, nice):
|
||||
registry_obj = RegistryObject(tag_name, nice)
|
||||
self.__values__.append(registry_obj)
|
||||
return RegisterItemDecorator(registry_obj)
|
||||
|
||||
|
||||
class RegistryObject:
|
||||
def __init__(self, tag_name, nice):
|
||||
self.tag_name = tag_name
|
||||
self.nice = nice
|
||||
self.value = None
|
||||
|
||||
|
||||
class RegisterItemDecorator:
|
||||
def __init__(self, register_obj):
|
||||
self.register_obj = register_obj
|
||||
|
||||
def __call__(self, value):
|
||||
self.register_obj.value = value
|
||||
return value
|
||||
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed 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.
|
||||
|
||||
|
||||
def GetGroupedTrivialOpNames():
|
||||
return [
|
||||
"pd_op.sin",
|
||||
"pd_op.add",
|
||||
"pd_op.relu",
|
||||
"pd_op.data",
|
||||
"pd_op.full",
|
||||
"pd_op.cast",
|
||||
"pd_op.exp",
|
||||
"pd_op.relu",
|
||||
"pd_op.tanh",
|
||||
"pd_op.floor",
|
||||
"pd_op.erf",
|
||||
"pd_op.elementwise_pow",
|
||||
"cinn_op.scale",
|
||||
"pd_op.subtract",
|
||||
"pd_op.add",
|
||||
"pd_op.multiply",
|
||||
"pd_op.divide",
|
||||
"pd_op.maximum",
|
||||
"cinn_op.yield_store",
|
||||
"cinn_op.broadcast",
|
||||
"pd_op.expand",
|
||||
"cinn_op.generate_shape",
|
||||
]
|
||||
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed 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.
|
||||
|
||||
import __builtin__
|
||||
|
||||
DataType = __builtin__.DataType
|
||||
DataValue = __builtin__.DataValue
|
||||
PointerType = __builtin__.PointerType
|
||||
PointerValue = __builtin__.PointerValue
|
||||
MutableList = __builtin__.MutableList
|
||||
OrderedDict = __builtin__.OrderedDict
|
||||
MutableOrderedDict = __builtin__.MutableOrderedDict
|
||||
AttrMap = __builtin__.AttrMap
|
||||
SerializableAttrMap = __builtin__.SerializableAttrMap
|
||||
|
||||
_raise = __builtin__._raise
|
||||
|
||||
foreach = __builtin__.foreach
|
||||
range = __builtin__.range
|
||||
map = __builtin__.map
|
||||
reduce = __builtin__.reduce
|
||||
filter = __builtin__.filter
|
||||
zip = __builtin__.zip
|
||||
flat_map = __builtin__.flat_map
|
||||
apply = __builtin__.apply
|
||||
replace_or_trim_left_comma = __builtin__.replace_or_trim_left_comma
|
||||
|
||||
registry = __builtin__registry # noqa: F821
|
||||
|
||||
sorted = __builtin__.sorted
|
||||
|
||||
dirname = __builtin__.dirname
|
||||
basename = __builtin__.basename
|
||||
Reference in New Issue
Block a user