We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a342d13 commit 253f12bCopy full SHA for 253f12b
1 file changed
graph_net/torch/utils.py
@@ -23,16 +23,19 @@ def apply_templates(forward_code: str) -> str:
23
def get_limited_precision_float_str(value):
24
if not isinstance(value, float):
25
return value
26
- if not math.isfinite(value):
27
- return f'float("{value}")'
28
return f"{value:.3f}"
29
30
31
def convert_state_and_inputs_impl(state_dict, example_inputs):
32
def tensor_info(tensor):
33
is_float = tensor.dtype.is_floating_point
34
mean = float(tensor.mean().item()) if is_float else None
35
- std = float(tensor.std().item()) if is_float else None
+ std = None
+ if is_float:
+ if tensor.numel() <= 1:
36
+ std = 0.0
37
+ else:
38
+ std = float(tensor.std().item())
39
return {
40
"shape": list(tensor.shape),
41
"dtype": str(tensor.dtype),
0 commit comments