/usr/local/lib64/python3.6/site-packages/torch/utils/tensorboard/__pycache__
Edit: /usr/local/lib64/python3.6/site-packages/torch/utils/tensorboard/__pycache__/summary.cpython-36.pyc (22199B)
3
EgRt @ s d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dl m
Z
d dlmZ d dlm
Z
d dlmZ d dlmZ d d lmZ d d
lmZ d dlmZ d dlmZ d
dlmZ d
dlmZmZ dd ZdDddZdEddZ dFddZ!dd Z"dGddZ#dHdd Z$dId"d#Z%dJd%d&Z&dKd'd(Z'dLd)d*Z(dMd,d-Z)d.d/ Z*dNd1d2Z+d3d4 Z,d5d6 Z-dOd8d9Z.dPd:d;Z/dQd
d? Z1d@dA Z2dRdBdCZ3dS )S N)Optional)range)
struct_pb2)Summary)HistogramProto)SummaryMetadata)TensorProto)TensorShapeProto)TextPluginData)PrCurvePluginData)
layout_pb2 )make_np)_prepare_videoconvert_to_HWCc C s, t | tjs| j n| }|jtjkr(dS dS )Nr
)
isinstancenpZndarraynumpydtypeuint8)tensorZ converted r K/usr/local/lib64/python3.6/site-packages/torch/utils/tensorboard/summary.py_calc_scale_factor s r black c C s ddl m} m}
|
j }| j| }||||f\}
}}}|j|
|f|
|f||f||f|
|fg||d |r|}|j|\}}tjd| }|j |
|| d| f|
| |fg|d |j
|
| || | f|||d | S )Nr ) ImageDraw ImageFont)widthfillg?r )r )r font)PILr r Zload_defaultZDrawlinegetsizer ceilZ rectangletext)imageZxminZyminZxmaxZymaxdisplay_strcolorZ
color_textZ thicknessr r r! ZdrawleftrighttopZbottomZtext_bottom
text_widthZtext_heightmarginr r r _draw_single_box s"
r/ c s ddl }ddlm} ddlm}m}m mm}m } ddl
m} m}
m
}m}m}
ddlm}m}m} ttstjd tdt|tstjd td|pi }t|tstd xR|j D ]F\}kst|t stfd
d|D rtdjqW g }| }xj D ]\}|dkr8q t|tsPt|tr||j _ |krt!j"d
d | D d}nd}|j#||j$d|d q t||r||j _%|krt!j"dd | D d}nd}|j#||j$d|d q t|t&rd||j _'|krBt!j"dd | D d}nd}|j#||j$d|d q t||j(rt)|d }||j _ |j#||j$dd q t*dq W |||
d}t+t+j,| |j- dd}t.t.j$||dgd} fdd|j/ D }|||d}|||
d}t+t+j,| |j- dd}t.t.j$||dgd}||j$d d!}|||
d"}t+t+j,| |j- dd}t.t.j$|
|dgd}|||fS )#a2 Outputs three `Summary` protocol buffers needed by hparams plugin.
`Experiment` keeps the metadata of an experiment, such as the name of the
hyperparameters and the name of the metrics.
`SessionStartInfo` keeps key-value pairs of the hyperparameters
`SessionEndInfo` describes status of the experiment e.g. STATUS_SUCCESS
Args:
hparam_dict: A dictionary that contains names of the hyperparameters
and their values.
metric_dict: A dictionary that contains names of the metrics
and their values.
hparam_domain_discrete: (Optional[Dict[str, List[Any]]]) A dictionary that
contains names of the hyperparameters and all discrete values they can hold
Returns:
The `Summary` protobufs for Experiment, SessionStartInfo and
SessionEndInfo
r N)string_types)
Experiment
HParamInfo
MetricInfo
MetricNameStatusDataType)PLUGIN_NAMEPLUGIN_DATA_VERSIONEXPERIMENT_TAGSESSION_START_INFO_TAGSESSION_END_INFO_TAG)HParamsPluginDataSessionEndInfoSessionStartInfoz>parameter: hparam_dict should be a dictionary, nothing logged.z>parameter: metric_dict should be a dictionary, nothing logged.zIparameter: hparam_domain_discrete should be a dictionary, nothing logged.c 3 s | ]}t |t V qd S )N)r type).0d)hparam_dictkr r o s zhparams..zWparameter: hparam_domain_discrete[{}] should be a list of same type as hparam_dict[{}].c S s g | ]}t j|d qS ))number_value)r Value)r@ rA r r r