@@ -1323,8 +1323,8 @@ def L_op(self, inputs, outputs, output_gradients):
1323
1323
x , y = inputs
1324
1324
assert outputs [0 ].type == bool
1325
1325
return [
1326
- x .zeros_like (). astype ( config .floatX ),
1327
- y .zeros_like (). astype ( config .floatX ),
1326
+ x .zeros_like (dtype = config .floatX ),
1327
+ y .zeros_like (dtype = config .floatX ),
1328
1328
]
1329
1329
1330
1330
def c_code_cache_version (self ):
@@ -1358,7 +1358,7 @@ def output_types(self, *input_dtypes):
1358
1358
def L_op (self , inputs , outputs , output_gradients ):
1359
1359
(x ,) = inputs
1360
1360
assert outputs [0 ].type == bool
1361
- return [x .zeros_like (). astype ( config .floatX )]
1361
+ return [x .zeros_like (dtype = config .floatX )]
1362
1362
1363
1363
def c_code_cache_version (self ):
1364
1364
super_version = super ().c_code_cache_version ()
@@ -1577,7 +1577,7 @@ def get_grad(self, elem):
1577
1577
)
1578
1578
raise NotImplementedError (msg )
1579
1579
elif elem .type in discrete_types :
1580
- return elem .zeros_like (). astype ( config .floatX )
1580
+ return elem .zeros_like (dtype = config .floatX )
1581
1581
else :
1582
1582
return elem .zeros_like ()
1583
1583
@@ -1611,13 +1611,13 @@ def L_op(self, inputs, outputs, gout):
1611
1611
second_part = switch (cond , 0.0 , gz )
1612
1612
1613
1613
if outputs [0 ].type in discrete_types :
1614
- first_part = ift .zeros_like (config .floatX )
1615
- second_part = iff .zeros_like (config .floatX )
1614
+ first_part = ift .zeros_like (dtype = config .floatX )
1615
+ second_part = iff .zeros_like (dtype = config .floatX )
1616
1616
1617
1617
# cond does affect the elements of the output so it is connected.
1618
1618
# For the sake of making the gradient convenient we assume that
1619
1619
# condition + epsilon always triggers the same branch as condition
1620
- condition_grad = cond .zeros_like (). astype ( config .floatX )
1620
+ condition_grad = cond .zeros_like (dtype = config .floatX )
1621
1621
1622
1622
return (condition_grad , first_part , second_part )
1623
1623
@@ -1644,7 +1644,7 @@ def output_types(self, *input_types):
1644
1644
return upcast_out (* input_types [0 ])
1645
1645
1646
1646
def grad (self , inputs , output_gradients ):
1647
- return [inputs [0 ].zeros_like (). astype ( config .floatX )]
1647
+ return [inputs [0 ].zeros_like (dtype = config .floatX )]
1648
1648
1649
1649
1650
1650
class BinaryBitOp (BinaryScalarOp ):
@@ -1664,8 +1664,8 @@ def output_types(self, *input_types):
1664
1664
def grad (self , inputs , output_gradients ):
1665
1665
a , b = inputs
1666
1666
return [
1667
- a .zeros_like (). astype ( config .floatX ),
1668
- b .zeros_like (). astype ( config .floatX ),
1667
+ a .zeros_like (dtype = config .floatX ),
1668
+ b .zeros_like (dtype = config .floatX ),
1669
1669
]
1670
1670
1671
1671
@@ -1776,8 +1776,8 @@ def L_op(self, inputs, outputs, gout):
1776
1776
1777
1777
if outputs [0 ].type in discrete_types :
1778
1778
return [
1779
- x .zeros_like (). astype ( config .floatX ),
1780
- y .zeros_like (). astype ( config .floatX ),
1779
+ x .zeros_like (dtype = config .floatX ),
1780
+ y .zeros_like (dtype = config .floatX ),
1781
1781
]
1782
1782
# This form handle the case when both value are the same.
1783
1783
# In that case, gx will be gz, gy will be 0.
@@ -1818,8 +1818,8 @@ def L_op(self, inputs, outputs, gout):
1818
1818
1819
1819
if outputs [0 ].type in discrete_types :
1820
1820
return [
1821
- x .zeros_like (). astype ( config .floatX ),
1822
- y .zeros_like (). astype ( config .floatX ),
1821
+ x .zeros_like (dtype = config .floatX ),
1822
+ y .zeros_like (dtype = config .floatX ),
1823
1823
]
1824
1824
# This form handle the case when both value are the same.
1825
1825
# In that case, gx will be gz, gy will be 0.
@@ -1861,7 +1861,7 @@ def L_op(self, inputs, outputs, gout):
1861
1861
retval = []
1862
1862
for ii , inp in enumerate (inputs ):
1863
1863
if hasattr (inp , "zeros_like" ):
1864
- retval .append (inp .zeros_like (). astype ( config .floatX ))
1864
+ retval .append (inp .zeros_like (dtype = config .floatX ))
1865
1865
else :
1866
1866
retval .append (grad_undefined (self , ii , inp ))
1867
1867
else :
@@ -1937,7 +1937,7 @@ def grad(self, inputs, gout):
1937
1937
)
1938
1938
1939
1939
if output_type in discrete_types :
1940
- return [ipt .zeros_like (). astype ( config .floatX ) for ipt in inputs ]
1940
+ return [ipt .zeros_like (dtype = config .floatX ) for ipt in inputs ]
1941
1941
1942
1942
for input in inputs :
1943
1943
if gz .type in complex_types :
@@ -1980,8 +1980,8 @@ def L_op(self, inputs, outputs, gout):
1980
1980
raise NotImplementedError ()
1981
1981
if outputs [0 ].type in discrete_types :
1982
1982
return [
1983
- x .zeros_like (). astype ( config .floatX ),
1984
- y .zeros_like (). astype ( config .floatX ),
1983
+ x .zeros_like (dtype = config .floatX ),
1984
+ y .zeros_like (dtype = config .floatX ),
1985
1985
]
1986
1986
1987
1987
first_part = gz
@@ -2293,8 +2293,8 @@ def L_op(self, inputs, outputs, gout):
2293
2293
2294
2294
if outputs [0 ].type in discrete_types :
2295
2295
return [
2296
- x .zeros_like (). astype ( config .floatX ),
2297
- y .zeros_like (). astype ( config .floatX ),
2296
+ x .zeros_like (dtype = config .floatX ),
2297
+ y .zeros_like (dtype = config .floatX ),
2298
2298
]
2299
2299
2300
2300
first_part = gz * y * x ** (y - 1 )
@@ -2385,7 +2385,7 @@ def L_op(self, inputs, outputs, gout):
2385
2385
2386
2386
def handle_int (v ):
2387
2387
if outputs [0 ].type in int_types :
2388
- return v .zeros_like (). astype ( config .floatX )
2388
+ return v .zeros_like (dtype = config .floatX )
2389
2389
return v
2390
2390
2391
2391
return list (map (handle_int , [gx , gmn , gmx ]))
@@ -2422,7 +2422,7 @@ def grad(self, inputs, gout):
2422
2422
# to deal with real-valued inputs by rounding them to the
2423
2423
# nearest integer. f(x+eps) thus equals f(x) so the gradient
2424
2424
# is zero, not disconnected or undefined
2425
- return DisconnectedType ()(), y .zeros_like ()
2425
+ return DisconnectedType ()(), y .zeros_like (dtype = config . floatX )
2426
2426
2427
2427
2428
2428
second = Second (transfer_type (1 ), name = "second" )
@@ -2494,7 +2494,7 @@ def grad(self, inputs, gout):
2494
2494
if self .o_type in continuous_types :
2495
2495
return [gz ]
2496
2496
else :
2497
- return [x .zeros_like (). astype ( config .floatX )]
2497
+ return [x .zeros_like (dtype = config .floatX )]
2498
2498
2499
2499
def c_code_cache_version (self ):
2500
2500
s = super ().c_code_cache_version ()
@@ -2715,7 +2715,7 @@ def impl(self, x):
2715
2715
def grad (self , inputs , gout ):
2716
2716
(x ,) = inputs
2717
2717
(gz ,) = gout
2718
- return [x .zeros_like (). astype ( config .floatX )]
2718
+ return [x .zeros_like (dtype = config .floatX )]
2719
2719
2720
2720
def c_code (self , node , name , inputs , outputs , sub ):
2721
2721
(x ,) = inputs
0 commit comments