I am trying to write a function which is a part of tfx (Tensorflow Extended) Transform component. I want to use some tf.Transform module (note its something different than tfx Transform component) functions inside. This is my first time with Tensoflow, so I’d love to debug and see the result of each line of code ..

#### Category : eager-execution

I have built a custom keras model and during its forward pass, it uses the output of a function from another library. However, the parameter to this function must be a numpy array. During model.compile() I can set the run_eagerly parameter to True, then I can convert the output from forward pass to numpy by ..

The code snippet below is a vanila implementation of a TensorFlow model in which I am using subclass model and a custom fit function (implemented through train_step and test_step). The code works fine in the eager execution mode (default mode of execution in TF2.0) but fails in the graph mode. import numpy as np import ..

I want to save a tensorflow variable of type tensorflow.python.framework.ops.Tensor as a .npy file while eager execution is disabled. Now this works absolutely fine with eager execution enabled if I simply do tfvar.numpy() and then save it as .npy but it doesn’t work with if eager execution is disabled. Is there any way to do ..

I need to compute tf.Variable gradients in a class method, but use those gradients to update the variables at a later time, in a different method. I can do this when not using the @tf.function decorator, but I get the TypeError: An op outside of the function building code is being passed a "Graph" tensor ..

I am defining a custom layer as the last one of my network. Here I need to convert a tensor, the input one, into a numpy array to define a function on it. In particular, I want to define my last layer similarly to this: import tensorflow as tf def hat(x): A = tf.constant([[0.,-x[2],x[1]],[x[2],0.,-x[0]],[-x[1],x[0],0.]]) return ..

I am facing a problem and I cannot seem to find the solution anywhere else, so I decided to post my question here (I have basic knowledge of tensorflow but quite new): I wrote a simple code in python to illustrate what I want to do. import tensorflow as tf def generated_dict(): graph = {‘input’: ..

I’m trying have a keras functional API model and I want to use EagerTensor.numpy() method in it, so it’s important to use the model in eager mode. Lets say that I want to run the code below: input = tensorflow.keras.layers.Input((3,)) x = input.numpy() y = 2 * x model = keras.Model(input, y, name = "model") ..

I’m getting the error AttributeError: ‘Tensor’ object has no attribute ‘numpy’ when trying to change a tf tensor to a numpy array and then back to a tensor. The code giving me the error is as follow. network = models.Sequential() network.add(layers.Dense(512,activation=’relu’)) network.add(layers.Dense(10,activation=’linear’)) def root_mean_squared_error(y_true, y_pred): y_pred = y_pred.numpy() y_pred = tf.convert_to_tensor(y_pred) return K.sqrt(K.mean(K.square(y_pred – y_true))) ..

I am playing around with TensorFlow, and I am trying to export a Keras Model as a TensorFlow Model. And I ran into the above-mentioned error. I am following the “Build Deep Learning Applications with Keras 2.0” from Lynda (https://www.linkedin.com/learning/building-deep-learning-applications-with-keras-2-0/exporting-google-cloud-compatible-models?u=42751868) While trying to build a tensor flow model, I came across this error, thrown at ..

## Recent Comments