mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-12-22 10:11:52 +01:00
Merge b7e005427c
into 72eda9a24f
This commit is contained in:
commit
145833ca71
@ -45,21 +45,22 @@ class _KeyRecorder(object):
|
||||
# convert tensorio tensor type to numpy data type.
|
||||
# also returns element size in bytes.
|
||||
def _get_data_type(data_type):
|
||||
if data_type == 'Double':
|
||||
match data_type:
|
||||
case 'Double':
|
||||
return (np.float64, 8)
|
||||
|
||||
if data_type == 'Float':
|
||||
case 'Float':
|
||||
return (np.float32, 4)
|
||||
|
||||
if data_type == 'Int':
|
||||
case 'Int':
|
||||
return (np.int32, 4)
|
||||
|
||||
if data_type == 'Long':
|
||||
case 'Long':
|
||||
return (np.int64, 8)
|
||||
|
||||
if data_type == 'Byte':
|
||||
case 'Byte':
|
||||
return (np.int8, 1)
|
||||
|
||||
case _:
|
||||
raise ValueError('Unexpected tensorio data type: ' + data_type)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user