2

I want to use the built in resnet in tf-slim for a quick experiment. I did according to the README in github:

import tensorflow as tf
import tensorflow.contrib.slim as slim

resnet = tf.contrib.slim.nets.resnet_v1

mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
x = tf.placeholder("float", shape=[None, 784])
y_ = tf.placeholder("float", shape=[None, 10])
pred = resnet.resnet_v1_50(x)

cross_entropy = -tf.reduce_sum(y_ * tf.log(pred))

But got such an error:AttributeError: module 'tensorflow.contrib.slim' has no attribute 'nets'. I have already installed the latest version of tensorflow-0.12.0.
How can I fix this issue?

southdoor
  • 431
  • 1
  • 8
  • 22

1 Answers1

0

import like this:

from tensorflow.contrib.slim.nets import resnet_v1

slim = tf.contrib.slim
rus
  • 1
  • 1