Skip to content

Commit

Permalink
import tensorflow as tf for line 16
Browse files Browse the repository at this point in the history
Resolves many but not all of the 16 undefined names...

flake8 testing of https://github.com/thtrieu/darkflow on Python 3.6.3
```
$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
./darkflow/net/vanilla/train.py:14:11: F821 undefined name 'tf'
	_truth = tf.placeholders(out_dtype, out_shape)
          ^
./darkflow/net/vanilla/train.py:22:10: F821 undefined name 'tf'
		loss = tf.nn.l2_loss(diff)
         ^
./darkflow/net/vanilla/train.py:25:11: F821 undefined name 'tf'
		small = tf.cast(diff < 1, tf.float32)
          ^
./darkflow/net/vanilla/train.py:25:29: F821 undefined name 'tf'
		small = tf.cast(diff < 1, tf.float32)
                            ^
./darkflow/net/vanilla/train.py:27:13: F821 undefined name 'tf'
		l1_loss = tf.nn.l1_loss(tf.multiply(diff, large))
            ^
./darkflow/net/vanilla/train.py:27:27: F821 undefined name 'tf'
		l1_loss = tf.nn.l1_loss(tf.multiply(diff, large))
                          ^
./darkflow/net/vanilla/train.py:28:13: F821 undefined name 'tf'
		l2_loss = tf.nn.l2_loss(tf.multiply(diff, small))
            ^
./darkflow/net/vanilla/train.py:28:27: F821 undefined name 'tf'
		l2_loss = tf.nn.l2_loss(tf.multiply(diff, small))
                          ^
./darkflow/net/vanilla/train.py:35:10: F821 undefined name 'tf'
		loss = tf.nn.softmax_cross_entropy_with_logits(logits, y)
         ^
./darkflow/net/vanilla/train.py:35:50: F821 undefined name 'logits'
		loss = tf.nn.softmax_cross_entropy_with_logits(logits, y)
                                                 ^
./darkflow/net/vanilla/train.py:35:58: F821 undefined name 'y'
		loss = tf.nn.softmax_cross_entropy_with_logits(logits, y)
                                                         ^
./darkflow/net/vanilla/train.py:36:10: F821 undefined name 'tf'
		loss = tf.reduce_mean(loss)
         ^
./darkflow/net/vanilla/train.py:42:13: F821 undefined name 'tf'
		self.nu = tf.Variable(tf.ones([train_size, num_classes]))            ^
./darkflow/net/vanilla/train.py:42:25: F821 undefined name 'tf'
		self.nu = tf.Variable(tf.ones([train_size, num_classes]))                        ^
./darkflow/net/vanilla/train.py:42:34: F821 undefined name 'train_size'
		self.nu = tf.Variable(tf.ones([train_size, num_classes]))                                 ^
./darkflow/net/vanilla/train.py:42:46: F821 undefined name 'num_classes'
		self.nu = tf.Variable(tf.ones([train_size, num_classes]))                                             ^
16    F821 undefined name 'tf'
```
  • Loading branch information
cclauss authored Mar 22, 2018
1 parent 5fe906b commit 088de44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion darkflow/net/vanilla/train.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import tensorflow as tf

_LOSS_TYPE = ['sse','l2', 'smooth',
'sparse', 'l1', 'softmax',
'svm', 'fisher']
Expand Down Expand Up @@ -39,4 +41,4 @@ def loss(self, net_out):
assert 'train_size' in m, \
'Must specify'
size = m['train_size']
self.nu = tf.Variable(tf.ones([train_size, num_classes]))
self.nu = tf.Variable(tf.ones([train_size, num_classes]))

0 comments on commit 088de44

Please sign in to comment.