MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _vars_attr

Method _vars_attr

python/paddle/base/framework.py:4007–4025  ·  view source on GitHub ↗

Get the Variables attribute by name. Args: name(str): the attribute name. Returns: Variables: the Variables attribute.

(self, name)

Source from the content-addressed store, hash-verified

4005 return self.block._var_recursive(attr_var_name)
4006
4007 def _vars_attr(self, name):
4008 """
4009 Get the Variables attribute by name.
4010
4011 Args:
4012 name(str): the attribute name.
4013
4014 Returns:
4015 Variables: the Variables attribute.
4016 """
4017 attr_type = self.desc.attr_type(name, True)
4018 assert attr_type == core.AttrType.VARS, (
4019 f"Required type attr({name}) is list[Variable], but received {attr_type}"
4020 )
4021 attr_vars = [
4022 self.block._var_recursive(var.name())
4023 for var in self.desc.attr(name, True)
4024 ]
4025 return attr_vars
4026
4027 def all_attrs(self):
4028 """

Callers 1

all_attrsMethod · 0.95

Calls 4

attr_typeMethod · 0.80
_var_recursiveMethod · 0.80
nameMethod · 0.45
attrMethod · 0.45

Tested by

no test coverage detected