我正在public class OddsOrEvens {
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
System.out.println("Let’s play a game called \"Odds and Evens\"");
System.out.println("Whats your name ? ");
String name = sc.nextLine();
System.out.println("Hi "+ name +", which do you choose? (O)dds or (E)vens?");
String selection = sc.nextLine();
System.out.println("selection: " + selection);
while (selection.compareToIgnoreCase("O") >0 || selection.compareToIgnoreCase("E") >0){
System.out.println("Please enter the correct choice. Select 'O' for odds or 'E' for evens");
selection = sc.next();
}
if(selection.equalsIgnoreCase("O")){
System.out.println(name + " has picked Odds! The computer will be evens.");
}else if (selection.equalsIgnoreCase("E")){
System.out.println(name + " has picked Evens! The computer will be Odds.");
}
}
上试用Tensorflow
示例,但是当我尝试使用Variables
进行打印时出现错误
tf.Session
我很确定我没有在其他任何地方定义并在Spyder上删除了所有变量
ValueError: Variable my_int_variable already exists, disallowed. Did
you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:
答案 0 :(得分:1)
在使用变量之前,不要初始化变量。试试这个:
class Goal(models.Model):
# values that I am storing in my SQLlite DB
title = models.CharField(max_length=1000)
body = models.TextField()
created_data = models.DateTimeField(auto_now_add=True, auto_now=False)
updated_data = models.DateTimeField(auto_now_add=False, auto_now=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
# user = models.OneToOneField(User, on_delete=models.CASCADE)
def __str__(self):
return self.title
# Where I am trying to authenticate the user
def get_queryset(self, *args, **kwargs):
return Goal.objects.all().filter(owner=self.request.user)
它在我的机器上产生零初始化数组。此外,最好在打印函数中评估变量。