91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3.24KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發布日期: 2021-03-03
  • 語言: Python
  • 標簽: tensorflow??and??xor??

資源簡介

在tensorflow中實現的and和xor函數的例子

資源截圖

代碼片段和文件信息

#!/usr/bin/env?python

import?tensorflow?as?tf
import?math
import?numpy?as?np

INPUT_COUNT?=?2
OUTPUT_COUNT?=?2
HIDDEN_COUNT?=?2
LEARNING_RATE?=?0.1
MAX_STEPS?=?5000

#?For?every?training?loop?we?are?going?to?provide?the?same?input?and?expected?output?data
INPUT_TRAIN?=?np.array([[0?0]?[0?1]?[1?0]?[1?1]])
OUTPUT_TRAIN?=?np.array([[1?0]?[0?1]?[0?1]?[1?0]])

#?Nodes?are?created?in?Tensorflow?using?placeholders.?Placeholders?are?values?that?we?will?input?when?we?ask?Tensorflow?to?run?a?computation.
#?Create?inputs?x?consisting?of?a?2d?tensor?of?floating?point?numbers
inputs_placeholder?=?tf.placeholder(“float“
shape=[None?INPUT_COUNT])
labels_placeholder?=?tf.placeholder(“float“
shape=[None?OUTPUT_COUNT])

#?We?need?to?create?a?python?dictionary?object?with?placeholders?as?keys?and?feed?tensors?as?values
feed_dict?=?{
inputs_placeholder:?INPUT_TRAIN
labels_placeholder:?OUTPUT_TRAIN
}

#?Define?weights?and?biases?from?input?layer?to?hidden?l

評論

共有 條評論