1

I declared net_input as a global variable but still I am getting NameError: name 'net_input' is not defined

global net_input

noise = net_input.detach().clone()

Error line is:

net_input_saved = net_input.detach().clone()

Error

NameError: name 'net_input' is not defined

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
anu priya
  • 45
  • 1
  • 1
  • 7

1 Answers1

0

First you need to define variable and then make it global to use in entire program.

net_input = "some object"   # assume this is an object and defined somewhere else in your program

global net_input            # make sure that net_input is defined prior 

noise = net_input.detach().clone()
G1Rao
  • 424
  • 5
  • 11