-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Cleartext float via sytorch (#186)
* float added from kanav-gpt in sytorch * cleartext_fp added in Onnxbridge * i64->T in tensor.h * debug statement * typecast corrected in module.h * removing debug statement * added testing for sytorch float ct * rename tests
- Loading branch information
1 parent
01285e9
commit c6e60b1
Showing
13 changed files
with
650 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include <sytorch/backend/cleartext.h> | ||
#include <sytorch/backend/float.h> | ||
|
||
template <typename T> | ||
Backend<T> *defaultBackend() | ||
{ | ||
if constexpr (std::is_floating_point<T>::value) | ||
{ | ||
return new FloatClearText<T>(); | ||
} | ||
else | ||
{ | ||
return new ClearText<T>(); | ||
} | ||
} | ||
|
||
template <typename T> | ||
inline T type_cast(float val); | ||
|
||
template <> | ||
float type_cast(float val) | ||
{ | ||
return val; | ||
} | ||
|
||
template <> | ||
i64 type_cast(float val) | ||
{ | ||
return (i64)val; | ||
} | ||
|
||
template <> | ||
u64 type_cast(float val) | ||
{ | ||
return (u64(i64(val))); | ||
} |
Oops, something went wrong.