stdlib: Fix PyStats Distribution to be vector of Scalars
As Distribution inherits from Vector, it should be constructed with a Dictionary of scalars (in our implementation, a dictionary mapping the vector position's unique id for each bin and the value of that bin). Change-Id: Ie603c248e5db4b6dd7f71cc453eebd78793f69a3
This commit is contained in:
@@ -164,7 +164,7 @@ class Distribution(Vector):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
value: Iterable[int],
|
||||
value: Dict[Union[int, float], Scalar],
|
||||
min: Union[float, int],
|
||||
max: Union[float, int],
|
||||
num_bins: int,
|
||||
|
||||
@@ -167,8 +167,16 @@ def __get_distribution(statistic: _m5.stats.DistInfo) -> Distribution:
|
||||
overflow = statistic.overflow
|
||||
logs = statistic.logs
|
||||
|
||||
parsed_values = {}
|
||||
for index in range(len(value)):
|
||||
parsed_values[index] = Scalar(
|
||||
value=value[index],
|
||||
unit=statistic.unit,
|
||||
datatype=StorageType["f64"],
|
||||
)
|
||||
|
||||
return Distribution(
|
||||
value=value,
|
||||
value=parsed_values,
|
||||
min=min,
|
||||
max=max,
|
||||
num_bins=num_bins,
|
||||
|
||||
Reference in New Issue
Block a user