Skip to content

Commit

Permalink
Merge pull request #44 from remicres/43-more_supported_numeric_types
Browse files Browse the repository at this point in the history
ENH: add uint8, uint16, int16, uint32, int64
  • Loading branch information
remicres authored Mar 30, 2021
2 parents 542f6c3 + c7b8246 commit 4efc207
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions include/otbTensorflowCopyUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,23 @@ void RecopyImageRegionToTensorWithCast(const typename TImage::Pointer inputPtr,
{
tensorflow::DataType dt = tensor.dtype();
if (dt == tensorflow::DT_FLOAT)
RecopyImageRegionToTensor<TImage, float> (inputPtr, region, tensor, elemIdx);
RecopyImageRegionToTensor<TImage, float>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_DOUBLE)
RecopyImageRegionToTensor<TImage, double> (inputPtr, region, tensor, elemIdx);
RecopyImageRegionToTensor<TImage, double>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_UINT64)
RecopyImageRegionToTensor<TImage, unsigned long long int>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_INT64)
RecopyImageRegionToTensor<TImage, long long int>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_UINT32)
RecopyImageRegionToTensor<TImage, unsigned int>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_INT32)
RecopyImageRegionToTensor<TImage, int> (inputPtr, region, tensor, elemIdx);
RecopyImageRegionToTensor<TImage, int>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_UINT16)
RecopyImageRegionToTensor<TImage, unsigned short int> (inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_INT16)
RecopyImageRegionToTensor<TImage, short int>(inputPtr, region, tensor, elemIdx);
else if (dt == tensorflow::DT_UINT8)
RecopyImageRegionToTensor<TImage, unsigned char> (inputPtr, region, tensor, elemIdx);
else
itkGenericExceptionMacro("TF DataType "<< dt << " not currently implemented !");
}
Expand Down

0 comments on commit 4efc207

Please sign in to comment.