remove casting option
@@ -317,7 +317,7 @@ def _tuple_sorted_by_0(zs):
def einsum(*operands, **kwargs):
- """einsum(subscripts, *operands, dtype=False, casting='safe')
+ """einsum(subscripts, *operands, dtype=False)
Evaluates the Einstein summation convention on the operands.
Using the Einstein summation convention, many common multi-dimensional
@@ -327,7 +327,7 @@ def einsum(*operands, **kwargs):
.. note::
Memory contiguity of calculation result is not always compatible with
`numpy.einsum`.
- ``out`` and ``order`` options are not supported.
+ ``out``, ``order``, and ``casting`` options are not supported.
Args:
subscripts (str): Specifies the subscripts for summation.
@@ -347,7 +347,9 @@ def einsum(*operands, **kwargs):
assert isinstance(operands, list)
dtype = kwargs.pop('dtype', None)
- casting = kwargs.pop('casting', 'safe')
+
+ # casting = kwargs.pop('casting', 'safe')
+ casting_kwargs = {} # casting is not supported yet in astype
optimize = kwargs.pop('optimize', False)
# assert optimize is False, "optimize: sorry"
@@ -468,7 +470,7 @@ def einsum(*operands, **kwargs):
operands[num] = (
operands[num]
- .astype(result_dtype, casting=casting, copy=False)
+ .astype(result_dtype, copy=False, **casting_kwargs)
.sum(axis=sum_axes)
# .sum uses platform integer types by default
.astype(result_dtype, copy=False)
@@ -478,7 +480,7 @@ def einsum(*operands, **kwargs):
operands = [arr.view() for arr in operands]
else:
operands = [
- arr.astype(result_dtype, casting=casting, copy=False)
+ arr.astype(result_dtype, copy=False, **casting_kwargs)
for arr in operands
]
