Skip to content

Commit 902c409

Browse files
author
Joe Petviashvili
committed
add f16
1 parent d8c3337 commit 902c409

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/common.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export af_binary_op, af_border_type, af_canny_threshold, af_colormap, af_connect
2828
export af_conv_mode, af_cspace_t, af_diffusion_eq, af_dtype, af_err, af_features, af_flux_function, af_homography_type
2929
export af_image_format, af_interp_type, af_marker_type, af_mat_prop, af_match_type, af_moment_type, af_norm_type
3030
export af_random_engine, af_random_engine_type, af_someenum_t, af_source, af_storage, af_topk_function
31-
export af_window, af_ycc_std, b8, c32, c64, dim_t, f32, f64, intl, s16, s32, s64, u16, u32, u64, u8, uintl
31+
export af_window, af_ycc_std, b8, c32, c64, dim_t, f16, f32, f64, intl, s16, s32, s64, u16, u32, u64, u8, uintl
3232

3333
const dim_t = Clonglong
3434
const intl = Clonglong
@@ -73,6 +73,7 @@ const s64 = (UInt32)(8)
7373
const u64 = (UInt32)(9)
7474
const s16 = (UInt32)(10)
7575
const u16 = (UInt32)(11)
76+
const f16 = (UInt32)(12)
7677
# end enum af_dtype
7778

7879
# begin enum af_source

src/util.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ af_type(::Type{UInt32}) = u32
144144
af_type(::Type{UInt8}) = u8
145145
af_type(::Type{Int64}) = s64
146146
af_type(::Type{UInt64}) = u64
147+
af_type(::Type{Float16}) = f16
147148

148149
function af_jltype(i::af_dtype)::Type
149150
if i == f32
@@ -170,6 +171,8 @@ function af_jltype(i::af_dtype)::Type
170171
return Int16
171172
elseif i == u16
172173
return UInt16
174+
elseif i == f16
175+
return Float16
173176
else
174177
error("Unknown type: $i")
175178
end

0 commit comments

Comments
 (0)