Skip to content

Commit 0679f1b

Browse files
sharadmvtensorflower-gardener
authored andcommitted
Updated generated linop files
PiperOrigin-RevId: 377130710
1 parent 039070d commit 0679f1b

File tree

6 files changed

+45
-45
lines changed

6 files changed

+45
-45
lines changed

tensorflow_probability/python/internal/backend/numpy/gen/linear_operator.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def __init__(self,
265265
self._name = name or type(self).__name__
266266

267267
@contextlib.contextmanager
268-
def _name_scope(self, name=None):
268+
def _name_scope(self, name=None): # pylint: disable=method-hidden
269269
"""Helper function to standardize op scope."""
270270
full_name = self.name
271271
if name is not None:
@@ -357,7 +357,7 @@ def shape_tensor(self, name="shape_tensor"):
357357
Returns:
358358
`int32` `Tensor`
359359
"""
360-
with self._name_scope(name):
360+
with self._name_scope(name): # pylint: disable=not-callable
361361
# Prefer to use statically defined shape if available.
362362
if tensor_shape.TensorShape(self.shape).is_fully_defined():
363363
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"):
392392
`int32` `Tensor`
393393
"""
394394
# 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
396396
return self._batch_shape_tensor()
397397

398398
def _batch_shape_tensor(self, shape=None):
@@ -419,7 +419,7 @@ def tensor_rank(self, name="tensor_rank"):
419419
Python integer, or None if the tensor rank is undefined.
420420
"""
421421
# 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
423423
return tensor_shape.TensorShape(self.shape).ndims
424424

425425
def tensor_rank_tensor(self, name="tensor_rank_tensor"):
@@ -435,7 +435,7 @@ def tensor_rank_tensor(self, name="tensor_rank_tensor"):
435435
`int32` `Tensor`, determined at runtime.
436436
"""
437437
# 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
439439
return self._tensor_rank_tensor()
440440

441441
def _tensor_rank_tensor(self, shape=None):
@@ -478,7 +478,7 @@ def domain_dimension_tensor(self, name="domain_dimension_tensor"):
478478
`int32` `Tensor`
479479
"""
480480
# 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
482482
return self._domain_dimension_tensor()
483483

484484
def _domain_dimension_tensor(self, shape=None):
@@ -522,7 +522,7 @@ def range_dimension_tensor(self, name="range_dimension_tensor"):
522522
`int32` `Tensor`
523523
"""
524524
# 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
526526
return self._range_dimension_tensor()
527527

528528
def _range_dimension_tensor(self, shape=None):
@@ -581,7 +581,7 @@ def assert_non_singular(self, name="assert_non_singular"):
581581
An `Assert` `Op`, that, when run, will raise an `InvalidArgumentError` if
582582
the operator is singular.
583583
"""
584-
with self._name_scope(name):
584+
with self._name_scope(name): # pylint: disable=not-callable
585585
return self._assert_non_singular()
586586

587587
def _assert_positive_definite(self):
@@ -614,7 +614,7 @@ def assert_positive_definite(self, name="assert_positive_definite"):
614614
An `Assert` `Op`, that, when run, will raise an `InvalidArgumentError` if
615615
the operator is not positive definite.
616616
"""
617-
with self._name_scope(name):
617+
with self._name_scope(name): # pylint: disable=not-callable
618618
return self._assert_positive_definite()
619619

620620
def _assert_self_adjoint(self):
@@ -640,7 +640,7 @@ def assert_self_adjoint(self, name="assert_self_adjoint"):
640640
An `Assert` `Op`, that, when run, will raise an `InvalidArgumentError` if
641641
the operator is not self-adjoint.
642642
"""
643-
with self._name_scope(name):
643+
with self._name_scope(name): # pylint: disable=not-callable
644644
return self._assert_self_adjoint()
645645

646646
def _check_input_dtype(self, arg):
@@ -694,10 +694,10 @@ def matmul(self, x, adjoint=False, adjoint_arg=False, name="matmul"):
694694
"Operators are incompatible. Expected `x` to have dimension"
695695
" {} but got {}.".format(
696696
left_operator.domain_dimension, right_operator.range_dimension))
697-
with self._name_scope(name):
697+
with self._name_scope(name): # pylint: disable=not-callable
698698
return linear_operator_algebra.matmul(left_operator, right_operator)
699699

700-
with self._name_scope(name):
700+
with self._name_scope(name): # pylint: disable=not-callable
701701
x = ops.convert_to_tensor(x, name="x")
702702
# self._check_input_dtype(x)
703703

@@ -744,7 +744,7 @@ def matvec(self, x, adjoint=False, name="matvec"):
744744
Returns:
745745
A `Tensor` with shape `[..., M]` and same `dtype` as `self`.
746746
"""
747-
with self._name_scope(name):
747+
with self._name_scope(name): # pylint: disable=not-callable
748748
x = ops.convert_to_tensor(x, name="x")
749749
# self._check_input_dtype(x)
750750
self_dim = -2 if adjoint else -1
@@ -776,7 +776,7 @@ def determinant(self, name="det"):
776776
raise NotImplementedError(
777777
"Determinant not implemented for an operator that is expected to "
778778
"not be square.")
779-
with self._name_scope(name):
779+
with self._name_scope(name): # pylint: disable=not-callable
780780
return self._determinant()
781781

782782
def _log_abs_determinant(self):
@@ -805,7 +805,7 @@ def log_abs_determinant(self, name="log_abs_det"):
805805
raise NotImplementedError(
806806
"Determinant not implemented for an operator that is expected to "
807807
"not be square.")
808-
with self._name_scope(name):
808+
with self._name_scope(name): # pylint: disable=not-callable
809809
return self._log_abs_determinant()
810810

811811
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"):
887887
"Operators are incompatible. Expected `rhs` to have dimension"
888888
" {} but got {}.".format(
889889
left_operator.domain_dimension, right_operator.range_dimension))
890-
with self._name_scope(name):
890+
with self._name_scope(name): # pylint: disable=not-callable
891891
return linear_operator_algebra.solve(left_operator, right_operator)
892892

893-
with self._name_scope(name):
893+
with self._name_scope(name): # pylint: disable=not-callable
894894
rhs = ops.convert_to_tensor(rhs, name="rhs")
895895
# self._check_input_dtype(rhs)
896896

@@ -947,7 +947,7 @@ def solvevec(self, rhs, adjoint=False, name="solve"):
947947
Raises:
948948
NotImplementedError: If `self.is_non_singular` or `is_square` is False.
949949
"""
950-
with self._name_scope(name):
950+
with self._name_scope(name): # pylint: disable=not-callable
951951
rhs = ops.convert_to_tensor(rhs, name="rhs")
952952
# self._check_input_dtype(rhs)
953953
self_dim = -1 if adjoint else -2
@@ -970,7 +970,7 @@ def adjoint(self, name="adjoint"):
970970
"""
971971
if self.is_self_adjoint is True: # pylint: disable=g-bool-id-comparison
972972
return self
973-
with self._name_scope(name):
973+
with self._name_scope(name): # pylint: disable=not-callable
974974
return linear_operator_algebra.adjoint(self)
975975

976976
# self.H is equivalent to self.adjoint().
@@ -998,7 +998,7 @@ def inverse(self, name="inverse"):
998998
raise ValueError("Cannot take the Inverse: This operator represents "
999999
"a singular matrix.")
10001000

1001-
with self._name_scope(name):
1001+
with self._name_scope(name): # pylint: disable=not-callable
10021002
return linear_operator_algebra.inverse(self)
10031003

10041004
def cholesky(self, name="cholesky"):
@@ -1023,7 +1023,7 @@ def cholesky(self, name="cholesky"):
10231023
if not self._can_use_cholesky():
10241024
raise ValueError("Cannot take the Cholesky decomposition: "
10251025
"Not a positive definite self adjoint matrix.")
1026-
with self._name_scope(name):
1026+
with self._name_scope(name): # pylint: disable=not-callable
10271027
return linear_operator_algebra.cholesky(self)
10281028

10291029
def _to_dense(self):
@@ -1044,7 +1044,7 @@ def _to_dense(self):
10441044

10451045
def to_dense(self, name="to_dense"):
10461046
"""Return a dense (batch) matrix representing this operator."""
1047-
with self._name_scope(name):
1047+
with self._name_scope(name): # pylint: disable=not-callable
10481048
return self._to_dense()
10491049

10501050
def _diag_part(self):
@@ -1076,7 +1076,7 @@ def diag_part(self, name="diag_part"):
10761076
Returns:
10771077
diag_part: A `Tensor` of same `dtype` as self.
10781078
"""
1079-
with self._name_scope(name):
1079+
with self._name_scope(name): # pylint: disable=not-callable
10801080
return self._diag_part()
10811081

10821082
def _trace(self):
@@ -1093,7 +1093,7 @@ def trace(self, name="trace"):
10931093
Returns:
10941094
Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
10951095
"""
1096-
with self._name_scope(name):
1096+
with self._name_scope(name): # pylint: disable=not-callable
10971097
return self._trace()
10981098

10991099
def _add_to_tensor(self, x):
@@ -1110,7 +1110,7 @@ def add_to_tensor(self, x, name="add_to_tensor"):
11101110
Returns:
11111111
A `Tensor` with broadcast shape and same `dtype` as `self`.
11121112
"""
1113-
with self._name_scope(name):
1113+
with self._name_scope(name): # pylint: disable=not-callable
11141114
x = ops.convert_to_tensor(x, name="x")
11151115
# self._check_input_dtype(x)
11161116
return self._add_to_tensor(x)
@@ -1134,7 +1134,7 @@ def eigvals(self, name="eigvals"):
11341134
"""
11351135
if not self.is_self_adjoint:
11361136
raise NotImplementedError("Only self-adjoint matrices are supported.")
1137-
with self._name_scope(name):
1137+
with self._name_scope(name): # pylint: disable=not-callable
11381138
return self._eigvals()
11391139

11401140
def _cond(self):
@@ -1159,7 +1159,7 @@ def cond(self, name="cond"):
11591159
Returns:
11601160
Shape `[B1,...,Bb]` `Tensor` of same `dtype` as `self`.
11611161
"""
1162-
with self._name_scope(name):
1162+
with self._name_scope(name): # pylint: disable=not-callable
11631163
return self._cond()
11641164

11651165
def _can_use_cholesky(self):

tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_block_diag.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,10 @@ class docstring for definition of shape compatibility.
366366
"Operators are incompatible. Expected `x` to have dimension"
367367
" {} but got {}.".format(
368368
left_operator.domain_dimension, right_operator.range_dimension))
369-
with self._name_scope(name):
369+
with self._name_scope(name): # pylint: disable=not-callable
370370
return linear_operator_algebra.matmul(left_operator, right_operator)
371371

372-
with self._name_scope(name):
372+
with self._name_scope(name): # pylint: disable=not-callable
373373
arg_dim = -1 if adjoint_arg else -2
374374
block_dimensions = (self._block_range_dimensions() if adjoint
375375
else self._block_domain_dimensions())
@@ -446,7 +446,7 @@ def matvec(self, x, adjoint=False, name="matvec"):
446446
Returns:
447447
A `Tensor` with shape `[..., M]` and same `dtype` as `self`.
448448
"""
449-
with self._name_scope(name):
449+
with self._name_scope(name): # pylint: disable=not-callable
450450
block_dimensions = (self._block_range_dimensions() if adjoint
451451
else self._block_domain_dimensions())
452452
if linear_operator_util.arg_is_blockwise(block_dimensions, x, -1):
@@ -547,10 +547,10 @@ def solve(self, rhs, adjoint=False, adjoint_arg=False, name="solve"):
547547
"Operators are incompatible. Expected `rhs` to have dimension"
548548
" {} but got {}.".format(
549549
left_operator.domain_dimension, right_operator.range_dimension))
550-
with self._name_scope(name):
550+
with self._name_scope(name): # pylint: disable=not-callable
551551
return linear_operator_algebra.solve(left_operator, right_operator)
552552

553-
with self._name_scope(name):
553+
with self._name_scope(name): # pylint: disable=not-callable
554554
block_dimensions = (self._block_domain_dimensions() if adjoint
555555
else self._block_range_dimensions())
556556
arg_dim = -1 if adjoint_arg else -2
@@ -630,7 +630,7 @@ def solvevec(self, rhs, adjoint=False, name="solve"):
630630
Raises:
631631
NotImplementedError: If `self.is_non_singular` or `is_square` is False.
632632
"""
633-
with self._name_scope(name):
633+
with self._name_scope(name): # pylint: disable=not-callable
634634
block_dimensions = (self._block_domain_dimensions() if adjoint
635635
else self._block_range_dimensions())
636636
if linear_operator_util.arg_is_blockwise(block_dimensions, rhs, -1):

tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_block_lower_triangular.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ class docstring for definition of shape compatibility.
453453
"Operators are incompatible. Expected `x` to have dimension"
454454
" {} but got {}.".format(
455455
left_operator.domain_dimension, right_operator.range_dimension))
456-
with self._name_scope(name):
456+
with self._name_scope(name): # pylint: disable=not-callable
457457
return linear_operator_algebra.matmul(left_operator, right_operator)
458458

459-
with self._name_scope(name):
459+
with self._name_scope(name): # pylint: disable=not-callable
460460
arg_dim = -1 if adjoint_arg else -2
461461
block_dimensions = (self._block_range_dimensions() if adjoint
462462
else self._block_domain_dimensions())
@@ -567,7 +567,7 @@ def matvec(self, x, adjoint=False, name="matvec"):
567567
Returns:
568568
A `Tensor` with shape `[..., M]` and same `dtype` as `self`.
569569
"""
570-
with self._name_scope(name):
570+
with self._name_scope(name): # pylint: disable=not-callable
571571
block_dimensions = (self._block_range_dimensions() if adjoint
572572
else self._block_domain_dimensions())
573573
if linear_operator_util.arg_is_blockwise(block_dimensions, x, -1):
@@ -692,10 +692,10 @@ def solve(self, rhs, adjoint=False, adjoint_arg=False, name="solve"):
692692
"Operators are incompatible. Expected `rhs` to have dimension"
693693
" {} but got {}.".format(
694694
left_operator.domain_dimension, right_operator.range_dimension))
695-
with self._name_scope(name):
695+
with self._name_scope(name): # pylint: disable=not-callable
696696
return linear_operator_algebra.solve(left_operator, right_operator)
697697

698-
with self._name_scope(name):
698+
with self._name_scope(name): # pylint: disable=not-callable
699699
block_dimensions = (self._block_domain_dimensions() if adjoint
700700
else self._block_range_dimensions())
701701
arg_dim = -1 if adjoint_arg else -2
@@ -819,7 +819,7 @@ def solvevec(self, rhs, adjoint=False, name="solve"):
819819
Raises:
820820
NotImplementedError: If `self.is_non_singular` or `is_square` is False.
821821
"""
822-
with self._name_scope(name):
822+
with self._name_scope(name): # pylint: disable=not-callable
823823
block_dimensions = (self._block_domain_dimensions() if adjoint
824824
else self._block_range_dimensions())
825825
if linear_operator_util.arg_is_blockwise(block_dimensions, rhs, -1):

tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_circulant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def convolution_kernel(self, name="convolution_kernel"):
327327
Returns:
328328
`Tensor` with `dtype` `self.dtype`.
329329
"""
330-
with self._name_scope(name):
330+
with self._name_scope(name): # pylint: disable=not-callable
331331
h = self._ifft(_to_complex(self.spectrum))
332332
return _ops.cast(h, self.dtype)
333333

@@ -373,7 +373,7 @@ def assert_hermitian_spectrum(self, name="assert_hermitian_spectrum"):
373373
An `Op` that asserts this operator has Hermitian spectrum.
374374
"""
375375
eps = np.finfo(dtypes.real_dtype(self.dtype)).eps
376-
with self._name_scope(name):
376+
with self._name_scope(name): # pylint: disable=not-callable
377377
# Assume linear accumulation of error.
378378
max_err = eps * self.domain_dimension_tensor()
379379
imag_convolution_kernel = math_ops.imag(self.convolution_kernel())

tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_householder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def _trace(self):
246246

247247
def _determinant(self):
248248
# For householder transformations, the determinant is -1.
249-
return -array_ops.ones(shape=self.batch_shape_tensor(), dtype=self.dtype)
249+
return -array_ops.ones(shape=self.batch_shape_tensor(), dtype=self.dtype) # pylint: disable=invalid-unary-operand-type
250250

251251
def _log_abs_determinant(self):
252252
# Orthogonal matrix -> log|Q| = 0.
@@ -280,7 +280,7 @@ def _eigvals(self):
280280
neg_shape = array_ops.concat([result_shape[:-1], [1]], axis=-1)
281281
eigvals = array_ops.ones(shape=ones_shape, dtype=self.dtype)
282282
eigvals = array_ops.concat(
283-
[-array_ops.ones(shape=neg_shape, dtype=self.dtype), eigvals], axis=-1)
283+
[-array_ops.ones(shape=neg_shape, dtype=self.dtype), eigvals], axis=-1) # pylint: disable=invalid-unary-operand-type
284284
return eigvals
285285

286286
def _cond(self):

tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_identity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def add_to_tensor(self, mat, name="add_to_tensor"):
425425
Returns:
426426
A `Tensor` with broadcast shape and same `dtype` as `self`.
427427
"""
428-
with self._name_scope(name):
428+
with self._name_scope(name): # pylint: disable=not-callable
429429
mat = ops.convert_to_tensor(mat, name="mat")
430430
mat_diag = _linalg.diag_part(mat)
431431
new_diag = 1 + mat_diag
@@ -767,7 +767,7 @@ def add_to_tensor(self, mat, name="add_to_tensor"):
767767
Returns:
768768
A `Tensor` with broadcast shape and same `dtype` as `self`.
769769
"""
770-
with self._name_scope(name):
770+
with self._name_scope(name): # pylint: disable=not-callable
771771
# Shape [B1,...,Bb, 1]
772772
multiplier_vector = array_ops.expand_dims(self.multiplier, -1)
773773

0 commit comments

Comments
 (0)