Fix for null shape in SameDiff.var validation (#250)

Signed-off-by: AlexDBlack <blacka101@gmail.com>
master
Alex Black 2019-09-10 12:22:10 +10:00 committed by GitHub
parent c9f8a904ad
commit 3fb9aecb59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -3367,8 +3367,10 @@ public class SameDiff extends SDBaseOps {
*/
public SDVariable var(@NonNull String name, @NonNull VariableType variableType, WeightInitScheme weightInitScheme,
org.nd4j.linalg.api.buffer.DataType dataType, long... shape) {
for(long l : shape){
Preconditions.checkArgument(l != 0, "Cannot create variable with a shape that contains zeros (empty array shape) - got shape %s", shape);
if(shape != null) {
for (long l : shape) {
Preconditions.checkArgument(l != 0, "Cannot create variable with a shape that contains zeros (empty array shape) - got shape %s", shape);
}
}
if (name == null || name.length() < 1)