Skip to content

Commit c5aa7a8

Browse files
authored
Merge pull request #465 from JuliaComputing/kf/typemapping
Round out TensorFlow type mapping
2 parents 8669acd + f67a7f3 commit c5aa7a8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/constants.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
TF_QUINT16 = 16,
1818
TF_UINT16 = 17,
1919
TF_COMPLEX128 = 18,
20-
TF_HALF = 19)
21-
20+
TF_HALF = 19,
21+
TF_RESOURCE = 20,
22+
TF_VARIANT = 21,
23+
TF_UINT32 = 22,
24+
TF_UINT64 = 23)
2225

2326
@enum(TF_Code,
2427
TF_OK = 0,

src/core.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,10 +1372,13 @@ function Base.eltype(t::RawTensor)
13721372
tf_to_jl_type(tf_type)
13731373
end
13741374

1375-
const type_map = Dict(TF_UINT8=>UInt8, TF_FLOAT=>Float32, TF_INT32=>Int32,
1376-
TF_INT64=>Int64, TF_DOUBLE=>Float64, TF_STRING=>String,
1377-
TF_BOOL=>Bool, TF_COMPLEX64=>ComplexF32,
1378-
TF_COMPLEX128=>ComplexF64)
1375+
const type_map = Dict(TF_INT8=>Int8, TF_UINT8=>UInt8,
1376+
TF_INT16=>Int16, TF_UINT16=>UInt16,
1377+
TF_INT32=>Int32, TF_UINT32=>UInt32,
1378+
TF_INT64=>Int64, TF_UINT64=>UInt64,
1379+
TF_FLOAT=>Float32, TF_DOUBLE=>Float64,
1380+
TF_BOOL=>Bool, TF_STRING=>String,
1381+
TF_COMPLEX64=>ComplexF32, TF_COMPLEX128=>ComplexF64)
13791382
const inv_type_map = Dict(v=>k for (k, v) in type_map)
13801383

13811384
function tf_to_jl_type(dt::TF_DataType)

0 commit comments

Comments
 (0)