Skip to content

Commit

Permalink
Add trivial conversion of np.int32 and np.float32 in service message …
Browse files Browse the repository at this point in the history
…conversion
  • Loading branch information
sogartar committed Mar 31, 2022
1 parent c3cae40 commit 86e69f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler_gym/service/proto/py_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def __init__(self, converter: TypeBasedConverter):
DictEvent: "event_dict",
bool: "boolean_value",
int: "int64_value",
np.int32: "int64_value",
np.float32: "float_value",
float: "double_value",
str: "string_value",
Expand Down Expand Up @@ -371,7 +372,9 @@ def make_message_default_converter() -> TypeBasedConverter:
conversion_map = {
bool: convert_trivial,
int: convert_trivial,
np.int32: convert_trivial,
float: convert_trivial,
np.float32: convert_trivial,
str: convert_trivial,
bytes: convert_bytes_to_numpy,
BooleanTensor: convert_tensor_message_to_numpy,
Expand Down Expand Up @@ -425,7 +428,9 @@ def to_event_message_default_converter() -> ToEventMessageConverter:
conversion_map = {
bool: convert_trivial,
int: convert_trivial,
np.int32: convert_trivial,
float: convert_trivial,
np.float32: convert_trivial,
str: convert_trivial,
np.ndarray: NumpyToTensorMessageConverter(),
}
Expand Down

0 comments on commit 86e69f0

Please sign in to comment.