-
Notifications
You must be signed in to change notification settings - Fork 432
Setup for newer operator routines which have large and small float types #236
Conversation
Some Torch algorithms tend to have both types |
mshadow/base.h
Outdated
case mshadow::kFloat32: \ | ||
{ \ | ||
typedef float DType; \ | ||
typedef double DLargeType; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float is enough here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in Torch, they use double for summations across a tensor of floats in order to avoid overflows
mshadow/base.h
Outdated
case mshadow::kFloat16: \ | ||
{ \ | ||
typedef mshadow::half::half_t DType; \ | ||
typedef float DLargeType; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sometimes usefull but may break backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean -- this isn't use anywhere else so far, although I expect further non-mshadow ports to use it. What backward compatibility might be broken?
BatchNorm (and I presume others) have accumulators, for instance, which may require a larger type to hold summations or other progressive operations