Fix for null shape in SameDiff.var validation (#250)
Signed-off-by: AlexDBlack <blacka101@gmail.com>master
parent
c9f8a904ad
commit
3fb9aecb59
|
@ -3367,9 +3367,11 @@ public class SameDiff extends SDBaseOps {
|
||||||
*/
|
*/
|
||||||
public SDVariable var(@NonNull String name, @NonNull VariableType variableType, WeightInitScheme weightInitScheme,
|
public SDVariable var(@NonNull String name, @NonNull VariableType variableType, WeightInitScheme weightInitScheme,
|
||||||
org.nd4j.linalg.api.buffer.DataType dataType, long... shape) {
|
org.nd4j.linalg.api.buffer.DataType dataType, long... shape) {
|
||||||
for(long l : 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);
|
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)
|
if (name == null || name.length() < 1)
|
||||||
name = getNewVarName();
|
name = getNewVarName();
|
||||||
|
|
Loading…
Reference in New Issue