yunjey / stargan

StarGAN - Official PyTorch Implementation (CVPR 2018)
MIT License
5.21k stars 967 forks source link

AttributeError: module 'tensorflow' has no attribute 'Summary' #144

Open FantasticZihao opened 1 year ago

FantasticZihao commented 1 year ago

When I run the code to train the model on my dataset, i met the issue 'AttributeError: module 'tensorflow' has no attribute 'Summary'' . So what can i do to solve the issue?

MShafquat commented 1 year ago

I have got it working by changing the logger.py file as below:

import tensorflow as tf

class Logger(object):
    """Tensorboard logger."""

    def __init__(self, log_dir):
        """Initialize summary writer."""
        self.writer = tf.summary.create_file_writer(log_dir)

    def scalar_summary(self, tag, value, step):
        """Add scalar summary."""
        with self.writer.as_default():
            tf.summary.scalar(tag, value, step=step)
            self.writer.flush()
FantasticZihao commented 1 year ago

I have got it working by changing the logger.py file as below:

import tensorflow as tf

class Logger(object):
    """Tensorboard logger."""

    def __init__(self, log_dir):
        """Initialize summary writer."""
        self.writer = tf.summary.create_file_writer(log_dir)

    def scalar_summary(self, tag, value, step):
        """Add scalar summary."""
        with self.writer.as_default():
            tf.summary.scalar(tag, value, step=step)
            self.writer.flush()

Thank you. I have solved this.