Add optional warning for backwards incompatible broadcast.

Setting torch.utils.backcompat.broadcast.warning.enabled=True
will cause Python warnings in the case where broadcast occurs
but previously 1-d view style pointwise ops occured.
This commit is contained in:
Gregory Chanan
2017-05-15 14:08:59 -07:00
committed by Soumith Chintala
parent 5af46cb352
commit 3556d1b8a3
8 changed files with 77 additions and 3 deletions

View File

@ -551,3 +551,13 @@ void THPPointer<THPGenerator>::free() {
}
template class THPPointer<THPGenerator>;
static bool backCompatBroadcastWarn = false;
void setBackCompatBroadcastWarn(bool warn) {
backCompatBroadcastWarn = true;
}
bool getBackCompatBroadcastWarn() {
return backCompatBroadcastWarn;
}