File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ FILENAMES = [
5353 "private" ,
5454 "random_generators" ,
5555 "raw_ops" ,
56+ "resource_variable_ops" ,
5657 "sets_lib" ,
5758 "sparse_lib" ,
5859 "tensor_array_ops" ,
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ py_library(
5252 ":private" ,
5353 ":random_generators" ,
5454 ":raw_ops" ,
55+ ":resource_variable_ops" ,
5556 ":sets_lib" ,
5657 ":sparse_lib" ,
5758 ":static_rewrites" ,
@@ -332,6 +333,11 @@ py_library(
332333 ],
333334)
334335
336+ py_library (
337+ name = "resource_variable_ops" ,
338+ srcs = ["resource_variable_ops.py" ],
339+ )
340+
335341py_library (
336342 name = "sets_lib" ,
337343 srcs = ["sets_lib.py" ],
Original file line number Diff line number Diff line change 4646from tensorflow_probability .python .internal .backend .numpy .numpy_array import * # pylint: disable=wildcard-import
4747from tensorflow_probability .python .internal .backend .numpy .numpy_math import * # pylint: disable=wildcard-import
4848from tensorflow_probability .python .internal .backend .numpy .ops import * # pylint: disable=wildcard-import
49+ from tensorflow_probability .python .internal .backend .numpy .type_spec import BatchableTypeSpec
50+ from tensorflow_probability .python .internal .backend .numpy .type_spec import TypeSpec
4951
5052
5153Assert = debugging .Assert
Original file line number Diff line number Diff line change 6161 'Module' ,
6262 'Tensor' ,
6363 'TensorSpec' ,
64- 'TypeSpec' ,
6564 'Variable' ,
66- 'VariableSpec' ,
6765 # 'gradients',
6866]
6967
@@ -696,15 +694,10 @@ class Tensor(six.with_metaclass(_TensorMeta)):
696694
697695
698696class TensorSpec (object ):
699- pass
700697
701-
702- class TypeSpec (object ):
703- pass
704-
705-
706- class VariableSpec (object ):
707- pass
698+ def __init__ (self , * args , ** kwargs ):
699+ del args , kwargs
700+ self .dtype = None
708701
709702
710703class Module (object ):
Original file line number Diff line number Diff line change 1+ # Copyright 2021 The TensorFlow Probability Authors.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+ # ============================================================================
15+ """Numpy stub for `resource_variable_ops`."""
16+
17+ __all__ = [
18+ 'VariableSpec' ,
19+ ]
20+
21+
22+ class VariableSpec (object ):
23+
24+ def __init__ (self , * args , ** kwargs ):
25+ del args , kwargs
26+ self .dtype = None
Original file line number Diff line number Diff line change 2727# Although `inspect` is different between Python 2 and 3, we should only ever
2828# be using Python 3's inspect because JAX is Python 3 only and if TF is present
2929# we will use `tf_inspect` which is compatible with both Python 2 and 3.
30+ Parameter = inspect .Parameter
3031getfullargspec = inspect .getfullargspec
3132getcallargs = inspect .getcallargs
3233getframeinfo = inspect .getframeinfo
4647ismethod = inspect .ismethod
4748ismodule = inspect .ismodule
4849isroutine = inspect .isroutine
50+ signature = inspect .signature
4951stack = inspect .stack
Original file line number Diff line number Diff line change 1616
1717__all__ = [
1818 'lookup' ,
19- 'register'
19+ 'register' ,
20+ 'BatchableTypeSpec' ,
21+ 'TypeSpec' ,
2022]
2123
2224
@@ -30,3 +32,11 @@ def decorator_fn(cls):
3032def lookup (_ ):
3133 # Raise ValueError instead of NotImplementedError to conform to TF.
3234 raise ValueError ('`TypeSpec`s are not registered in Numpy/JAX.' )
35+
36+
37+ class TypeSpec (object ):
38+ pass
39+
40+
41+ class BatchableTypeSpec (TypeSpec ):
42+ pass
Original file line number Diff line number Diff line change 5151from tensorflow_probability .python .internal .backend .numpy .numpy_math import * # pylint: disable=wildcard-import
5252from tensorflow_probability .python .internal .backend .numpy .ops import * # pylint: disable=wildcard-import
5353from tensorflow_probability .python .internal .backend .numpy .tensor_array_ops import TensorArray
54+ from tensorflow_probability .python .internal .backend .numpy .type_spec import BatchableTypeSpec
55+ from tensorflow_probability .python .internal .backend .numpy .type_spec import TypeSpec
5456# pylint: enable=unused-import
5557
5658
Original file line number Diff line number Diff line change 6161 ('from tensorflow.python.ops import '
6262 'resource_variable_ops' ):
6363 ('from tensorflow_probability.python.internal.backend.numpy '
64- 'import ops ' ),
64+ 'import resource_variable_ops ' ),
6565 'from tensorflow.python.util import' :
6666 'from tensorflow_probability.python.internal.backend.numpy import' ,
6767 'from tensorflow.python.util.all_util' :
You can’t perform that action at this time.
0 commit comments