module 'tensorflow' has no attribute 'reduce_std'

Viewed 322

I have to use tensorflow version 1.2.1 for my coding assignment. And I am getting this error "module 'tensorflow' has no attribute 'reduce_std'"

class Dense(Layer):
    def __init__(self, input_units, output_units, learning_rate=0.1):
     
        graph = tf.Graph()
        with graph.as_default():
            initializer = tf.contrib.layers.xavier_initializer()
            self.weights = tf.Variable(initializer([input_units, output_units]))
            print(tf.reduce_std(self.weights, axis=None, keepdims=False, name=None))
            self.biases= tf.Variable(initializer([output_units,]))

could someone help me how to solve this?

1 Answers

My solution is to add

tf.math.reduce_std()

Also, need to check the tensorflow version first: print("TF version:", tf.__version__)

Related