8212e735fd187936161e64026eb46c599e1937d4,dlpy/network.py,Network,load_weights_from_table,#Network#Any#,1145
Before Change
contains the weight table.
"""
cas_lib_name, file_name, tmp_caslib = caslibify(self.conn, path, task="load")
self._retrieve_("table.loadtable",
caslib=cas_lib_name,
path=file_name,
casout=dict(replace=True, name=self.model_name + "_weights"))
self.set_weights(self.model_name + "_weights")
_file_name_, _extension_ = os.path.splitext(file_name)
_file_name_list_ = list(
self._retrieve_("table.fileinfo", caslib=cas_lib_name,
includeDirectories=False).FileInfo.Name)
if (_file_name_ + "_attr" + _extension_) in _file_name_list_:
print("NOTE: " + _file_name_ + "_attr" + _extension_ +
" is used as weigths attribute.")
self._retrieve_("table.loadtable",
caslib=cas_lib_name,
path=_file_name_ + "_attr" + _extension_,
casout=dict(replace=True,
name=self.model_name + "_weights_attr"))
self.set_weights_attr(self.model_name + "_weights_attr")
self.model_weights = self.conn.CASTable(name=self.model_name + "_weights")
if (cas_lib_name is not None) and tmp_caslib:
self._retrieve_("table.dropcaslib", message_level = "error", caslib = cas_lib_name)
def set_weights_attr(self, attr_tbl, clear=True):
"""
Attach the weights attribute to the model weights
After Change
contains the weight table.
"""
with caslibify_context(self.conn, path, task = "load") as (cas_lib_name, file_name):
self._retrieve_("table.loadtable",
caslib=cas_lib_name,
path=file_name,
casout=dict(replace=True, name=self.model_name + "_weights"))
self.set_weights(self.model_name + "_weights")
_file_name_, _extension_ = os.path.splitext(file_name)
_file_name_list_ = list(
self._retrieve_("table.fileinfo", caslib=cas_lib_name,
includeDirectories=False).FileInfo.Name)
if (_file_name_ + "_attr" + _extension_) in _file_name_list_:
print("NOTE: " + _file_name_ + "_attr" + _extension_ +
" is used as weigths attribute.")
self._retrieve_("table.loadtable",
caslib=cas_lib_name,
path=_file_name_ + "_attr" + _extension_,
casout=dict(replace=True,
name=self.model_name + "_weights_attr"))
self.set_weights_attr(self.model_name + "_weights_attr")
self.model_weights = self.conn.CASTable(name=self.model_name + "_weights")
def set_weights_attr(self, attr_tbl, clear=True):
"""
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 9
Instances
Project Name: sassoftware/python-dlpy
Commit Name: 8212e735fd187936161e64026eb46c599e1937d4
Time: 2019-09-05
Author: Wenyu.Shi@sas.com
File Name: dlpy/network.py
Class Name: Network
Method Name: load_weights_from_table
Project Name: sassoftware/python-dlpy
Commit Name: 8212e735fd187936161e64026eb46c599e1937d4
Time: 2019-09-05
Author: Wenyu.Shi@sas.com
File Name: dlpy/network.py
Class Name: Network
Method Name: load_weights_from_file_with_labels
Project Name: sassoftware/python-dlpy
Commit Name: 8212e735fd187936161e64026eb46c599e1937d4
Time: 2019-09-05
Author: Wenyu.Shi@sas.com
File Name: dlpy/network.py
Class Name: Network
Method Name: load_weights_from_file
Project Name: sassoftware/python-dlpy
Commit Name: 8212e735fd187936161e64026eb46c599e1937d4
Time: 2019-09-05
Author: Wenyu.Shi@sas.com
File Name: dlpy/network.py
Class Name: Network
Method Name: save_to_table_with_caslibify
Project Name: sassoftware/python-dlpy
Commit Name: 8212e735fd187936161e64026eb46c599e1937d4
Time: 2019-09-05
Author: Wenyu.Shi@sas.com
File Name: dlpy/network.py
Class Name: Network
Method Name: load_weights_from_table