Skip to content

Commit 4922d61

Browse files
authored
Enable BNNS copy for FP16 to FP32
Differential Revision: D80465059 Pull Request resolved: #13477
1 parent 4214942 commit 4922d61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backends/apple/coreml/runtime/delegate/multiarray.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ bool init_bnns_descriptor(BNNSNDArrayDescriptor& bnns_descriptor, const MultiArr
124124

125125
bool copy_using_bnns(const MultiArray& src, MultiArray& dst) {
126126
if (src.layout().dataType() != dst.layout().dataType()) {
127-
return false;
127+
// Copying from FP16 to FP32 is supported and this is a common use case
128+
if (!(src.layout().dataType() == MultiArray::DataType::Float16 && dst.layout().dataType() == MultiArray::DataType::Float32)) {
129+
return false;
130+
}
128131
}
129132
if (dst.layout().num_bytes() < src.layout().num_bytes()) {
130133
return false;

0 commit comments

Comments
 (0)