Title: Type Error on import of Tensorflow Code Block 3.7 Chapter 03 · Issue #212 · BayesianModelingandComputationInPython/BookCode_Edition1 · GitHub
Open Graph Title: Type Error on import of Tensorflow Code Block 3.7 Chapter 03 · Issue #212 · BayesianModelingandComputationInPython/BookCode_Edition1
X Title: Type Error on import of Tensorflow Code Block 3.7 Chapter 03 · Issue #212 · BayesianModelingandComputationInPython/BookCode_Edition1
Description: Chapter 03 Notebook Code 3.7 first cell cause type error on import of Tensorflow as tf import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions root = tfd.JointDistributionCoroutine.Root species_idx = tf.const...
Open Graph Description: Chapter 03 Notebook Code 3.7 first cell cause type error on import of Tensorflow as tf import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions root = tfd.JointDistribut...
X Description: Chapter 03 Notebook Code 3.7 first cell cause type error on import of Tensorflow as tf import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions root = tfd.JointDistribut...
Opengraph URL: https://github.com/BayesianModelingandComputationInPython/BookCode_Edition1/issues/212
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type Error on import of Tensorflow Code Block 3.7 Chapter 03","articleBody":"Chapter 03 Notebook Code 3.7 first cell cause type error on import of Tensorflow as tf\r\n\r\n\r\nimport tensorflow as tf\r\nimport tensorflow_probability as tfp\r\n\r\ntfd = tfp.distributions\r\nroot = tfd.JointDistributionCoroutine.Root\r\n\r\nspecies_idx = tf.constant(all_species.codes, tf.int32)\r\nbody_mass_g = tf.constant(penguins[\"body_mass_g\"], tf.float32)\r\n\r\n@tfd.JointDistributionCoroutine\r\ndef jd_penguin_mass_all_species():\r\n σ = yield root(tfd.Sample(\r\n tfd.HalfStudentT(df=100, loc=0, scale=2000),\r\n sample_shape=3,\r\n name=\"sigma\"))\r\n μ = yield root(tfd.Sample(\r\n tfd.Normal(loc=4000, scale=3000),\r\n sample_shape=3,\r\n name=\"mu\"))\r\n mass = yield tfd.Independent(\r\n tfd.Normal(loc=tf.gather(μ, species_idx, axis=-1),\r\n scale=tf.gather(σ, species_idx, axis=-1)),\r\n reinterpreted_batch_ndims=1,\r\n name=\"mass\")\r\n\r\n\r\n---------------------------------------------------------------------------\r\nTypeError Traceback (most recent call last)\r\n/tmp/ipykernel_21511/4136355668.py in \u003cmodule\u003e\r\n----\u003e 1 import tensorflow as tf\r\n 2 import tensorflow_probability as tfp\r\n 3 \r\n 4 tfd = tfp.distributions\r\n 5 root = tfd.JointDistributionCoroutine.Root\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/__init__.py in \u003cmodule\u003e\r\n 39 import sys as _sys\r\n 40 \r\n---\u003e 41 from tensorflow.python.tools import module_util as _module_util\r\n 42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader\r\n 43 \r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/python/__init__.py in \u003cmodule\u003e\r\n 39 \r\n 40 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow\r\n---\u003e 41 from tensorflow.python.eager import context\r\n 42 \r\n 43 # pylint: enable=wildcard-import\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/python/eager/context.py in \u003cmodule\u003e\r\n 31 import six\r\n 32 \r\n---\u003e 33 from tensorflow.core.framework import function_pb2\r\n 34 from tensorflow.core.protobuf import config_pb2\r\n 35 from tensorflow.core.protobuf import rewriter_config_pb2\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/core/framework/function_pb2.py in \u003cmodule\u003e\r\n 14 \r\n 15 \r\n---\u003e 16 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2\r\n 17 from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2\r\n 18 from tensorflow.core.framework import op_def_pb2 as tensorflow_dot_core_dot_framework_dot_op__def__pb2\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/core/framework/attr_value_pb2.py in \u003cmodule\u003e\r\n 14 \r\n 15 \r\n---\u003e 16 from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2\r\n 17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2\r\n 18 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/core/framework/tensor_pb2.py in \u003cmodule\u003e\r\n 14 \r\n 15 \r\n---\u003e 16 from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2\r\n 17 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2\r\n 18 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/core/framework/resource_handle_pb2.py in \u003cmodule\u003e\r\n 14 \r\n 15 \r\n---\u003e 16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2\r\n 17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2\r\n 18 \r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/tensorflow/core/framework/tensor_shape_pb2.py in \u003cmodule\u003e\r\n 34 containing_type=None,\r\n 35 fields=[\r\n---\u003e 36 _descriptor.FieldDescriptor(\r\n 37 name='size', full_name='tensorflow.TensorShapeProto.Dim.size', index=0,\r\n 38 number=1, type=3, cpp_type=2, label=1,\r\n\r\n~/mambaforge/envs/bmcp/lib/python3.9/site-packages/google/protobuf/descriptor.py in __new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key)\r\n 559 has_default_value=True, containing_oneof=None, json_name=None,\r\n 560 file=None, create_key=None): # pylint: disable=redefined-builtin\r\n--\u003e 561 _message.Message._CheckCalledFromGeneratedFile()\r\n 562 if is_extension:\r\n 563 return _message.default_pool.FindExtensionByName(full_name)\r\n\r\nTypeError: Descriptors cannot not be created directly.\r\nIf this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc \u003e= 3.19.0.\r\nIf you cannot immediately regenerate your protos, some other possible workarounds are:\r\n 1. Downgrade the protobuf package to 3.20.x or lower.\r\n 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).\r\n\r\nMore information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates\r\n\r\nOs = Ubuntu22.04\r\npython as per environment.yml\r\n","author":{"url":"https://github.com/RogerS49","@type":"Person","name":"RogerS49"},"datePublished":"2023-08-21T13:54:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/212/BookCode_Edition1/issues/212"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6d7f205f-9b3c-af66-843f-2a0f6d492528 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8946:12866F:128612:1943F1:698EEDCE |
| html-safe-nonce | c9c8c55b65c33e7ad2b0a2a4943539297c40bf34e518f4b904b00ddc8ddc3745 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTQ2OjEyODY2RjoxMjg2MTI6MTk0M0YxOjY5OEVFRENFIiwidmlzaXRvcl9pZCI6IjIzNDY3NzU4MDE2NjIyMDUzOTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bc9d45e7fe4badad3bab8f1614a33416328b3242260ba4bed8a786b0e00248b9 |
| hovercard-subject-tag | issue:1859431947 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/BayesianModelingandComputationInPython/BookCode_Edition1/212/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63cd7da40c04db703ca7a7a5511438567993c4b41714fa4a58dd9ceceacdf8b2/BayesianModelingandComputationInPython/BookCode_Edition1/issues/212 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63cd7da40c04db703ca7a7a5511438567993c4b41714fa4a58dd9ceceacdf8b2/BayesianModelingandComputationInPython/BookCode_Edition1/issues/212 |
| og:image:alt | Chapter 03 Notebook Code 3.7 first cell cause type error on import of Tensorflow as tf import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions root = tfd.JointDistribut... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RogerS49 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| go-import | github.com/BayesianModelingandComputationInPython/BookCode_Edition1 git https://github.com/BayesianModelingandComputationInPython/BookCode_Edition1.git |
| octolytics-dimension-user_id | 84690770 |
| octolytics-dimension-user_login | BayesianModelingandComputationInPython |
| octolytics-dimension-repository_id | 397286760 |
| octolytics-dimension-repository_nwo | BayesianModelingandComputationInPython/BookCode_Edition1 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 397286760 |
| octolytics-dimension-repository_network_root_nwo | BayesianModelingandComputationInPython/BookCode_Edition1 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 74ed479fe042e0ee79d00083dd248df8cc447655 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width