sagemaker-debugger
sagemaker-debugger copied to clipboard
implement save raw tensor API
Save raw tensor api needs to be implemented. Use case is - user wants to save a tensor which is not part of model graph.
The implementation would look like below -
def save_raw_tensor(tname, tval):
if self.writer is None:
self._initialize_writers()
self._write_raw_tensor_simple(scalar_name, scalar_val)
For time being there is workaround and users can try this function in script code -
import smdebug.tensorflow as smd ## Please replace with mxnet/xgboost/torch according to framework you are using
def save_raw_tensor(hook, tname, tval):
if hook.writer is None:
hook._initialize_writers()
hook._write_raw_tensor_simple(tname, tval)
hook = smd.get_hook(create_if_not_exists=True)
save_raw_tensor(hook, tname, tval)
-----
-----
----
--
hook.close() # this is final statement, tells hook to write the step