AttributeError: module 'tensorflow_federated' has no attribute 'templates' - tensorflow

federated_algorithm = tff.templates.IterativeProcess(
initialize_fn = initialize_fn, next_fn = next_fn)
TF=2.1.0
Tff=0.13.0
they are showing attribute error.

The tff.templates package was not available until TFF versions 0.14.0 and later. Prior to this, the IterativeProcess symbol existed in the tff.utils package.
See the 0.14.0 release notes for details about this change.

Related

Cannot access class 'jupyter.kotlin.MimeTypedResult'

I am running jupyter with the latest kotlin kernel
Kotlin kernel v. 0.11.0.170, Kotlin v. 1.8.0-dev-3517
I am using kotlin-jupyter-api version 0.11.0-183-1.
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlin-jupyter-api</artifactId>
<version>0.11.0-183-1</version>
</dependency>
I tried to put a MIME object (a png) to display in a cell by calling the API.
E.g.,
return new MimeTypedResult(singletonMap("text/html", html), false, null);
The MimeTypedResult returned is of class
org.jetbrains.kotlinx.jupyter.api.MimeTypedResult
in kotlin-jupyter-api version 0.11.0-183-1.
However, the notebook gives this error: Line_19.jupyter-kts (4:3 - 7) Cannot access class 'jupyter.kotlin.MimeTypedResult'. Check your module classpath for missing or conflicting dependencies
I cannot understand why it is looking for 'jupyter.kotlin.MimeTypedResult' instead of 'org.jetbrains.kotlinx.jupyter.api.MimeTypedResult'
enter image description here
I searched the source code in here but can't find anything about jupyter.kotlin.MimeTypedResult or jupyter-kts.
Can anybody help me to solve this problem?

Missing Template Arguments for pcl::gpu::EuclideanClusterExtraction in PCL-1.12

I am trying this example to use PCL with GPU and get the error
~/gpu-pcl/main.cpp:85: error: missing template arguments before ‘gec’
pcl::gpu::EuclideanClusterExtraction gec;
I have tried that example with pcl-1.11.1 and it worked well .But when updated to pcl-1.12.1, I get that error.
My work environment:
Ubuntu 18.04,
with Cmake version 3.20,
Is there anything that I have missed out??
In the documentation of pcl1.12:
template
class pcl::gpu::EuclideanClusterExtraction< PointT >
EuclideanClusterExtraction is a template class, thus the type of point of the point cloud is needed in the position of PointT, for example, PointXYZ.[https://pointclouds.org/documentation/classpcl_1_1gpu_1_1_euclidean_cluster_extraction.html#details]

The 'graphlib' utility is a mandatory dependency

I am using joint js 3.1.1 version and graphlib 2.1.8 version.
I have a code in my app to check cyclic reference in graph. For that purpose I have written below code
graphlib.alg.findCycles(graph.toGraphLib())
This line gives following error
Uncaught Error: The the "graphlib" utility is a mandatory dependency.
at Object.toGraphLib (joint.min.js?de6d:8)
at child.He.toGraphLib (joint.min.js?de6d:8)
at RestrictCyclicConnection (links.js?2d1e:46)
at child.eval (businessobjectdesigner.vue?b25b:856)
at triggerEvents (backbone.js?ab5c:338)
at triggerApi (backbone.js?ab5c:322)
at eventsApi (backbone.js?ab5c:110)
at child.Events.trigger (backbone.js?ab5c:312)
at child.notify (joint.min.js?de6d:8)
at child._notifyConnectEvent (joint.min.js?de6d:8)
I have imported graphlib in my file also. But still getting following error.
I have imported graphlib as
import graphlib from 'graphlib'
You can try by passing graphlib as a part of the options object, as follows-
graph.toGraphLib({graphlib: graphlib})

mpi4py: Replace built-in serialization

I'd like to replace MPI4PY's built-in Pickle-serialization with dill. According to the doc the class _p_Pickle should have 2 attributes called dumps and loads. However, python says there are no such attributes when i try the following
from mpi4py Import MPI
MPI._p_Pickle.dumps
-> AttributeError: type object 'mpi4py.MPI._p_Pickle' has no attribute 'dumps'
Where have dumps and loads gone?
In v2.0 you can change it via
MPI.pickle.dumps = dill.dumps
MPI.pickle.loads = dill.loads
It seems that the documentation is still from 2012.
Update
For v3.0 see here, i.e.:
MPI.pickle.__init__(dill.dumps, dill.loads)
You are probably using an older version. Use 1.3.1 not 1.2.x. Check the version number with mpi4py.__version__. If you are using 1.3.1 or newer, you can overload dumps and loads with serialization from dill, or cloudpickle, or a some other custom serializer.
>>> import mpi4py
>>> mpi4py.__version__
'1.3.1'

Elm Graphics.Input

I'm trying to run the Elm input examples from this page. Specifically, the Text Field example, and I'm getting an error saying that the Graphics.Input module is missing.
I've got this in a file called Main.elm:
import Graphics.Input as Input
main = let (field, state) = Input.field "Type here!"
in lift2 display field state
display field state =
field `above` asText state
If I run elm-server and navigate to localhost:8000, I get the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.
The problem may stem from an improper usage of:
Input.field, above
Compiling the project with elm --make Main.elm gives me
elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)
Is there something extra I need to do to install the Graphic.Input?
Additional Notes:
I'm running this on a Debian machine, and installed it using cabal install elm fairly recently (Jun 15 2013). The current version is labeled Elm-0.7.1.1.
If I hop into the chromium JS prompt and poke around, it turns out there's no Elm.Graphics.Input module, but there is an Elm.Input. There isn't a function called field, there's a similar looking one called textField, but it isn't trivially interchangeable.
Running this:
import Input
main = let (field, state) = textField "Type here!"
in lift2 display field state
display field state =
field `above` asText state
gives me the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
TypeError: a is undefined
The problem may stem from an improper usage of:
above
The Graphics.Input package is new in version 0.8. So, since you're running version 0.7, that explains your problem.
0.8 was released somewhat recently, but it's definitely been out longer than June 15th, so you probably just forgot to cabal update before installing it. Running cabal update now and then updating elm to 0.8 should fix your issue.