@@ -265,7 +265,7 @@ def __init__(self,
265
265
self ._name = name or type (self ).__name__
266
266
267
267
@contextlib .contextmanager
268
- def _name_scope (self , name = None ):
268
+ def _name_scope (self , name = None ): # pylint: disable=method-hidden
269
269
"""Helper function to standardize op scope."""
270
270
full_name = self .name
271
271
if name is not None :
@@ -357,7 +357,7 @@ def shape_tensor(self, name="shape_tensor"):
357
357
Returns:
358
358
`int32` `Tensor`
359
359
"""
360
- with self ._name_scope (name ):
360
+ with self ._name_scope (name ): # pylint: disable=not-callable
361
361
# Prefer to use statically defined shape if available.
362
362
if tensor_shape .TensorShape (self .shape ).is_fully_defined ():
363
363
return linear_operator_util .shape_tensor (tensor_shape .TensorShape (self .shape ).as_list ())
@@ -392,7 +392,7 @@ def batch_shape_tensor(self, name="batch_shape_tensor"):
392
392
`int32` `Tensor`
393
393
"""
394
394
# Derived classes get this "for free" once .shape() is implemented.
395
- with self ._name_scope (name ):
395
+ with self ._name_scope (name ): # pylint: disable=not-callable
396
396
return self ._batch_shape_tensor ()
397
397
398
398
def _batch_shape_tensor (self , shape = None ):
@@ -419,7 +419,7 @@ def tensor_rank(self, name="tensor_rank"):
419
419
Python integer, or None if the tensor rank is undefined.
420
420
"""
421
421
# Derived classes get this "for free" once .shape() is implemented.
422
- with self ._name_scope (name ):
422
+ with self ._name_scope (name ): # pylint: disable=not-callable
423
423
return tensor_shape .TensorShape (self .shape ).ndims
424
424
425
425
def tensor_rank_tensor (self , name = "tensor_rank_tensor" ):
@@ -435,7 +435,7 @@ def tensor_rank_tensor(self, name="tensor_rank_tensor"):
435
435
`int32` `Tensor`, determined at runtime.
436
436
"""
437
437
# Derived classes get this "for free" once .shape() is implemented.
438
- with self ._name_scope (name ):
438
+ with self ._name_scope (name ): # pylint: disable=not-callable
439
439
return self ._tensor_rank_tensor ()
440
440
441
441
def _tensor_rank_tensor (self , shape = None ):
@@ -478,7 +478,7 @@ def domain_dimension_tensor(self, name="domain_dimension_tensor"):
478
478
`int32` `Tensor`
479
479
"""
480
480
# Derived classes get this "for free" once .shape() is implemented.
481
- with self ._name_scope (name ):
481
+ with self ._name_scope (name ): # pylint: disable=not-callable
482
482
return self ._domain_dimension_tensor ()
483
483
484
484
def _domain_dimension_tensor (self , shape = None ):
@@ -522,7 +522,7 @@ def range_dimension_tensor(self, name="range_dimension_tensor"):
522
522
`int32` `Tensor`
523
523
"""
524
524
# Derived classes get this "for free" once .shape() is implemented.
525
- with self ._name_scope (name ):
525
+ with self ._name_scope (name ): # pylint: disable=not-callable
526
526
return self ._range_dimension_tensor ()
527
527
528
528
def _range_dimension_tensor (self , shape = None ):
@@ -581,7 +581,7 @@ def assert_non_singular(self, name="assert_non_singular"):
581
581
An `Assert` `Op`, that, when run, will raise an `InvalidArgumentError` if
582
582
the operator is singular.
583
583
"""
584
- with self ._name_scope (name ):
584
+ with self ._name_scope (name ): # pylint: disable=not-callable
585
585
return self ._assert_non_singular ()
586
586
587
587
def _assert_positive_definite (self ):
@@ -614,7 +614,7 @@ def assert_positive_definite(self, name="assert_positive_definite"):
614
614
An `Assert` `Op`, that, when run, will raise an `InvalidArgumentError` if
615
615
the operator is not positive definite.
616
616
"""
617
- with self ._name_scope (name ):
617
+ with self ._name_scope (name ): # pylint: disable=not-callable
618
618
return self ._assert_positive_definite ()
619
619
620
620
def _assert_self_adjoint (self ):
@@ -640,7 +640,7 @@ def assert_self_adjoint(self, name="assert_self_adjoint"):
640
640
An `Assert` `Op`, that, when run, will raise an `InvalidArgumentError` if
641
641
the operator is not self-adjoint.
642
642
"""
643
- with self ._name_scope (name ):
643
+ with self ._name_scope (name ): # pylint: disable=not-callable
644
644
return self ._assert_self_adjoint ()
645
645
646
646
def _check_input_dtype (self , arg ):
@@ -694,10 +694,10 @@ def matmul(self, x, adjoint=False, adjoint_arg=False, name="matmul"):
694
694
"Operators are incompatible. Expected `x` to have dimension"
695
695
" {} but got {}." .format (
696
696
left_operator .domain_dimension , right_operator .range_dimension ))
697
- with self ._name_scope (name ):
697
+ with self ._name_scope (name ): # pylint: disable=not-callable
698
698
return linear_operator_algebra .matmul (left_operator , right_operator )
699
699
700
- with self ._name_scope (name ):
700
+ with self ._name_scope (name ): # pylint: disable=not-callable
701
701
x = ops .convert_to_tensor (x , name = "x" )
702
702
# self._check_input_dtype(x)
703
703
@@ -744,7 +744,7 @@ def matvec(self, x, adjoint=False, name="matvec"):
744
744
Returns:
745
745
A `Tensor` with shape `[..., M]` and same `dtype` as `self`.
746
746
"""
747
- with self ._name_scope (name ):
747
+ with self ._name_scope (name ): # pylint: disable=not-callable
748
748
x = ops .convert_to_tensor (x , name = "x" )
749
749
# self._check_input_dtype(x)
750
750
self_dim = - 2 if adjoint else - 1
@@ -776,7 +776,7 @@ def determinant(self, name="det"):
776
776
raise NotImplementedError (
777
777
"Determinant not implemented for an operator that is expected to "
778
778
"not be square." )
779
- with self ._name_scope (name ):
779
+ with self ._name_scope (name ): # pylint: disable=not-callable
780
780
return self ._determinant ()
781
781
782
782
def _log_abs_determinant (self ):
@@ -805,7 +805,7 @@ def log_abs_determinant(self, name="log_abs_det"):
805
805
raise NotImplementedError (
806
806
"Determinant not implemented for an operator that is expected to "
807
807
"not be square." )
808
- with self ._name_scope (name ):
808
+ with self ._name_scope (name ): # pylint: disable=not-callable
809
809
return self ._log_abs_determinant ()
810
810
811
811
def _dense_solve (self , rhs , adjoint = False , adjoint_arg = False ):
@@ -887,10 +887,10 @@ def solve(self, rhs, adjoint=False, adjoint_arg=False, name="solve"):
887
887
"Operators are incompatible. Expected `rhs` to have dimension"
888
888
" {} but got {}." .format (
889
889
left_operator .domain_dimension , right_operator .range_dimension ))
890
- with self ._name_scope (name ):
890
+ with self ._name_scope (name ): # pylint: disable=not-callable
891
891
return linear_operator_algebra .solve (left_operator , right_operator )
892
892
893
- with self ._name_scope (name ):
893
+ with self ._name_scope (name ): # pylint: disable=not-callable
894
894
rhs = ops .convert_to_tensor (rhs , name = "rhs" )
895
895
# self._check_input_dtype(rhs)
896
896
@@ -947,7 +947,7 @@ def solvevec(self, rhs, adjoint=False, name="solve"):
947
947
Raises:
948
948
NotImplementedError: If `self.is_non_singular` or `is_square` is False.
949
949
"""
950
- with self ._name_scope (name ):
950
+ with self ._name_scope (name ): # pylint: disable=not-callable
951
951
rhs = ops .convert_to_tensor (rhs , name = "rhs" )
952
952
# self._check_input_dtype(rhs)
953
953
self_dim = - 1 if adjoint else - 2
@@ -970,7 +970,7 @@ def adjoint(self, name="adjoint"):
970
970
"""
971
971
if self .is_self_adjoint is True : # pylint: disable=g-bool-id-comparison
972
972
return self
973
- with self ._name_scope (name ):
973
+ with self ._name_scope (name ): # pylint: disable=not-callable
974
974
return linear_operator_algebra .adjoint (self )
975
975
976
976
# self.H is equivalent to self.adjoint().
@@ -998,7 +998,7 @@ def inverse(self, name="inverse"):
998
998
raise ValueError ("Cannot take the Inverse: This operator represents "
999
999
"a singular matrix." )
1000
1000
1001
- with self ._name_scope (name ):
1001
+ with self ._name_scope (name ): # pylint: disable=not-callable
1002
1002
return linear_operator_algebra .inverse (self )
1003
1003
1004
1004
def cholesky (self , name = "cholesky" ):
@@ -1023,7 +1023,7 @@ def cholesky(self, name="cholesky"):
1023
1023
if not self ._can_use_cholesky ():
1024
1024
raise ValueError ("Cannot take the Cholesky decomposition: "
1025
1025
"Not a positive definite self adjoint matrix." )
1026
- with self ._name_scope (name ):
1026
+ with self ._name_scope (name ): # pylint: disable=not-callable
1027
1027
return linear_operator_algebra .cholesky (self )
1028
1028
1029
1029
def _to_dense (self ):
@@ -1044,7 +1044,7 @@ def _to_dense(self):
1044
1044
1045
1045
def to_dense (self , name = "to_dense" ):
1046
1046
"""Return a dense (batch) matrix representing this operator."""
1047
- with self ._name_scope (name ):
1047
+ with self ._name_scope (name ): # pylint: disable=not-callable
1048
1048
return self ._to_dense ()
1049
1049
1050
1050
def _diag_part (self ):
@@ -1076,7 +1076,7 @@ def diag_part(self, name="diag_part"):
1076
1076
Returns:
1077
1077
diag_part: A `Tensor` of same `dtype` as self.
1078
1078
"""
1079
- with self ._name_scope (name ):
1079
+ with self ._name_scope (name ): # pylint: disable=not-callable
1080
1080
return self ._diag_part ()
1081
1081
1082
1082
def _trace (self ):
@@ -1093,7 +1093,7 @@ def trace(self, name="trace"):
1093
1093
Returns:
1094
1094
Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
1095
1095
"""
1096
- with self ._name_scope (name ):
1096
+ with self ._name_scope (name ): # pylint: disable=not-callable
1097
1097
return self ._trace ()
1098
1098
1099
1099
def _add_to_tensor (self , x ):
@@ -1110,7 +1110,7 @@ def add_to_tensor(self, x, name="add_to_tensor"):
1110
1110
Returns:
1111
1111
A `Tensor` with broadcast shape and same `dtype` as `self`.
1112
1112
"""
1113
- with self ._name_scope (name ):
1113
+ with self ._name_scope (name ): # pylint: disable=not-callable
1114
1114
x = ops .convert_to_tensor (x , name = "x" )
1115
1115
# self._check_input_dtype(x)
1116
1116
return self ._add_to_tensor (x )
@@ -1134,7 +1134,7 @@ def eigvals(self, name="eigvals"):
1134
1134
"""
1135
1135
if not self .is_self_adjoint :
1136
1136
raise NotImplementedError ("Only self-adjoint matrices are supported." )
1137
- with self ._name_scope (name ):
1137
+ with self ._name_scope (name ): # pylint: disable=not-callable
1138
1138
return self ._eigvals ()
1139
1139
1140
1140
def _cond (self ):
@@ -1159,7 +1159,7 @@ def cond(self, name="cond"):
1159
1159
Returns:
1160
1160
Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
1161
1161
"""
1162
- with self ._name_scope (name ):
1162
+ with self ._name_scope (name ): # pylint: disable=not-callable
1163
1163
return self ._cond ()
1164
1164
1165
1165
def _can_use_cholesky (self ):
0 commit comments