mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
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:
committed by
Soumith Chintala
parent
5af46cb352
commit
3556d1b8a3
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user