bugfix for empty_ (#114)
* bugfix for empty_ * use v.__class__(0) for scalar
This commit is contained in:
parent
69caf89908
commit
9c7d31e5d6
@ -569,10 +569,8 @@ class Batch:
|
||||
else: # scalar value
|
||||
warnings.warn('You are calling Batch.empty on a NumPy scalar, '
|
||||
'which may cause undefined behaviors.')
|
||||
if isinstance(v, (np.generic, Number)):
|
||||
self.__dict__[k] *= 0
|
||||
if np.isnan(self.__dict__[k]):
|
||||
self.__dict__[k] = 0
|
||||
if isinstance(v, (np.number, np.bool_, Number)):
|
||||
self.__dict__[k] = v.__class__(0)
|
||||
else:
|
||||
self.__dict__[k] = None
|
||||
return self
|
||||
|
Loading…
x
Reference in New Issue
Block a user