Home > other >  Variable conv1/weights already exists, disallowed. Did you mean to set reuse=Tru
Variable conv1/weights already exists, disallowed. Did you mean to set reuse=Tru

Time:09-17

 ValueError Traceback (the most recent call last) 
()
23 BATCH_SIZE,
24 CAPACITY)
---> 25 train_logits=model. Inference (train_batch BATCH_SIZE, N_CLASSES)
26 train_loss=model. Losses (train_logits train_label_batch)
27 train_op=model. Trainning (train_loss learning_rate)

E: \ cat and dog \ model py in inference (images, batch_size n_classes)
8 shape=[16] 3, 3, 3,,
9 dtype=tf float32,
---> 10, initializer=tf. Truncated_normal_initializer (stddev=0.1, dtype=tf. Float32))
11 biases=tf. Get_variable (' biases,
12 shape=[16],

D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ ops \ variable_scope py in get_variable (name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
1022 collections=collections, caching_device=caching_device,
1023 partitioner=partitioner, validate_shape=validate_shape,
-> 1024 custom_getter=custom_getter)
1025
1026

D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ ops \ variable_scope py in get_variable (self, var_store, name, shape, dtype,, initializer, regularizer, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
848 collections=collections, caching_device=caching_device,
849 partitioner=partitioner, validate_shape=validate_shape,
- & gt; 850 custom_getter=custom_getter)
851
852 def _get_partitioned_variable (self,

D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ ops \ variable_scope py in get_variable (self, the name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
344 reuse=reuse, trainable=trainable, collections=collections,
345 caching_device=caching_device partitioner=partitioner,
- & gt; 346 validate_shape=validate_shape)
347
348 def _get_partitioned_variable (

D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ ops \ variable_scope py in _true_getter (name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, partitioner, validate_shape)
329, initializer=, initializer, regularizer=regularizer, reuse=reuse,
330 trainable=trainable, collections=collections,
- & gt; 331 caching_device=caching_device validate_shape=validate_shape)
332
333 if custom_getter is not None:

D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ ops \ variable_scope py in _get_single_variable (self, the name, shape, dtype, initializer, regularizer, partition_info, reuse, trainable, collections, caching_device, validate_shape)
630 "Did you mean to set reuse=True in VarScope? "
631 "Originally defined at: \ n \ n % s" % (
- & gt; 632 the name, "". Join (traceback format_list (TB))))
633 found_var=self. _vars [name]
634 if not shape. Is_compatible_with (found_var get_shape ()) :

ValueError: Variable conv1/weights already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

The File "D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ framework \ ops py", line 1128, in __init__
Self. _traceback=_extract_stack ()
The File "D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ framework \ ops py", line 2240, in create_op
Original_op=self. _default_original_op op_def=op_def)
The File "D: \ Anaconda \ lib \ site - packages \ tensorflow \ python \ framework \ op_def_library py", line 759, in apply_op
Op_def=op_def)


Training dogs and cats war training set when the above problems, don't understand, ask the great spirit

CodePudding user response:

Model. Inference (train_batch BATCH_SIZE, N_CLASSES) this should be inside with tf. Variable_scope (' layer1) : this code, instead of with tf. Variable_scope (' layer1 'reuse=reuse) : the second parameter of True

CodePudding user response:

Add this code at the front: tf reset_default_graph ()

CodePudding user response:

Model. Inference (train_batch BATCH_SIZE, N_CLASSES) this should be inside with tf. Variable_scope (' layer1) : this code, instead of with tf. Variable_scope (' layer1, reuse=tf AUTO_REUSE) :

CodePudding user response:

Method is very good, perfect solve the problem, kiss

CodePudding user response:

Hello, I want to ask about the model. The inference (train_batch BATCH_SIZE, N_CLASSES) where the ah, rookie will not find,,,, cry fainted

CodePudding user response:

"Model. The inference" generation means you build neural network model of the piece of script

CodePudding user response:

null
  • Related