Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
default_signature_name = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data['default_signature'])
self.default_signature = self.signatures[
default_signature_name] if default_signature_name else None
# recover module info
module_info = self.desc.attr.map.data['module_info']
self.name = utils.from_module_attr_to_pyobj(
module_info.map.data['name'])
self.author = utils.from_module_attr_to_pyobj(
module_info.map.data['author'])
self.author_email = utils.from_module_attr_to_pyobj(
module_info.map.data['author_email'])
self.version = utils.from_module_attr_to_pyobj(
module_info.map.data['version'])
self.type = utils.from_module_attr_to_pyobj(
module_info.map.data['type'])
self.summary = utils.from_module_attr_to_pyobj(
module_info.map.data['summary'])
# recover extra info
extra_info = self.desc.attr.map.data['extra_info']
self.extra_info = {}
for key, value in extra_info.map.data.items():
self.extra_info[key] = utils.from_module_attr_to_pyobj(value)
# recover name prefix
self.name_prefix = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data["name_prefix"])
feed_names.append(var.alias)
for var in module_var.fetch_desc:
variable = self.program.global_block().vars[var.var_name]
outputs.append(variable)
fetch_names.append(var.alias)
self.signatures[sign] = create_signature(
sign,
inputs=inputs,
outputs=outputs,
feed_names=feed_names,
fetch_names=fetch_names)
# recover default signature
default_signature_name = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data['default_signature'])
self.default_signature = self.signatures[
default_signature_name] if default_signature_name else None
# recover module info
module_info = self.desc.attr.map.data['module_info']
self.name = utils.from_module_attr_to_pyobj(
module_info.map.data['name'])
self.author = utils.from_module_attr_to_pyobj(
module_info.map.data['author'])
self.author_email = utils.from_module_attr_to_pyobj(
module_info.map.data['author_email'])
self.version = utils.from_module_attr_to_pyobj(
module_info.map.data['version'])
self.type = utils.from_module_attr_to_pyobj(
module_info.map.data['type'])
def _recover_variable_info(self, program):
var_infos = self.desc.attr.map.data['var_infos']
for var_info in var_infos.map.data:
idx = utils.from_module_attr_to_pyobj(
var_infos.map.data[var_info].map.data['block_id'])
stop_gradient = utils.from_module_attr_to_pyobj(
var_infos.map.data[var_info].map.data['stop_gradient'])
block = program.blocks[idx]
var_name = self.get_var_name_with_prefix(var_info)
if var_name in block.vars:
var = block.vars[var_name]
var.stop_gradient = stop_gradient
def _load_processor(self):
processor_path = self.helper.processor_path()
if os.path.exists(processor_path):
sys.path.append(processor_path)
processor_name = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data['processor_info'])
self.processor = __import__(processor_name).Processor(module=self)
else:
self.processor = None
# recover default signature
default_signature_name = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data['default_signature'])
self.default_signature = self.signatures[
default_signature_name] if default_signature_name else None
# recover module info
module_info = self.desc.attr.map.data['module_info']
self.name = utils.from_module_attr_to_pyobj(
module_info.map.data['name'])
self.author = utils.from_module_attr_to_pyobj(
module_info.map.data['author'])
self.author_email = utils.from_module_attr_to_pyobj(
module_info.map.data['author_email'])
self.version = utils.from_module_attr_to_pyobj(
module_info.map.data['version'])
self.type = utils.from_module_attr_to_pyobj(
module_info.map.data['type'])
self.summary = utils.from_module_attr_to_pyobj(
module_info.map.data['summary'])
# recover extra info
extra_info = self.desc.attr.map.data['extra_info']
self.extra_info = {}
for key, value in extra_info.map.data.items():
self.extra_info[key] = utils.from_module_attr_to_pyobj(value)
# recover name prefix
self.name_prefix = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data["name_prefix"])
self.signatures[sign] = create_signature(
sign,
inputs=inputs,
outputs=outputs,
feed_names=feed_names,
fetch_names=fetch_names)
# recover default signature
default_signature_name = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data['default_signature'])
self.default_signature = self.signatures[
default_signature_name] if default_signature_name else None
# recover module info
module_info = self.desc.attr.map.data['module_info']
self.name = utils.from_module_attr_to_pyobj(
module_info.map.data['name'])
self.author = utils.from_module_attr_to_pyobj(
module_info.map.data['author'])
self.author_email = utils.from_module_attr_to_pyobj(
module_info.map.data['author_email'])
self.version = utils.from_module_attr_to_pyobj(
module_info.map.data['version'])
self.type = utils.from_module_attr_to_pyobj(
module_info.map.data['type'])
self.summary = utils.from_module_attr_to_pyobj(
module_info.map.data['summary'])
# recover extra info
extra_info = self.desc.attr.map.data['extra_info']
self.extra_info = {}
for key, value in extra_info.map.data.items():
self.default_signature = self.signatures[
default_signature_name] if default_signature_name else None
# recover module info
module_info = self.desc.attr.map.data['module_info']
self.name = utils.from_module_attr_to_pyobj(
module_info.map.data['name'])
self.author = utils.from_module_attr_to_pyobj(
module_info.map.data['author'])
self.author_email = utils.from_module_attr_to_pyobj(
module_info.map.data['author_email'])
self.version = utils.from_module_attr_to_pyobj(
module_info.map.data['version'])
self.type = utils.from_module_attr_to_pyobj(
module_info.map.data['type'])
self.summary = utils.from_module_attr_to_pyobj(
module_info.map.data['summary'])
# recover extra info
extra_info = self.desc.attr.map.data['extra_info']
self.extra_info = {}
for key, value in extra_info.map.data.items():
self.extra_info[key] = utils.from_module_attr_to_pyobj(value)
# recover name prefix
self.name_prefix = utils.from_module_attr_to_pyobj(
self.desc.attr.map.data["name_prefix"])