<jupyter_start><jupyter_text>shape의 None은 아직 배치 크기를 정하지 않았으므로 어떠한 크기든 될 수 있음을 의미한다.`x_input`의 두번째 인수는 `텐서의 크기``y_input`의 두번째 인수는 `클래스의 수`<jupyter_code>weights = tf.Variable(tf.random_normal([input_size, no_classes]))
bias = tf.Variable(tf.random_normal([no_classes]))
logits = tf.matmul(x_input, weights) + bias
softmax_cross_entropy = tf.nn.softmax_cross_entropy_with_logits(
     labels=y_input, logits=logits)
loss_operation = tf.reduce_mean(softmax_cross_entropy)
optimiser = tf.train.GradientDescentOptimizer(learning_rate=0.5).minimize(loss_operation)<jupyter_output>WARNING:tensorflow:From <ipython-input-16-6c85ecab5ba0>:2: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See `tf.nn.softmax_cross_entropy_with_logits_v2`.<jupyter_text>tf.nn.softmax_cross_entropy_with_logits(    labels,    logits,    axis=-1,    name=None)Measures the probability error in discrete classification tasks in which the classes are mutually exclusive (each entry is in exactly one class). For example, each CIFAR-10 image is labeled with one and only one label: an image can be a dog or a truck, but not both. Args:labels: Each vector along the class dimension should hold a valid probability distribution e.g. for the case in which labels are of shape [batch_size, num_classes], each row of labels[i] must be a valid probability distribution.logits: Per-label activations, typically a linear output. These activation energies are interpreted as unnormalized log probabilities.axis: The class dimension. Defaulted to -1 which is the last dimension.name: A name for the operation (optional).<jupyter_code>session = tf.Session()
session.run(tf.global_variables_initializer())
for batch_no in range(total_batches):
    mnist_batch = mnist_data.train.next_batch(batch_size)
    _, loss_value = session.run([www., loss_operation], feed_dict={
        x_input: mnist_batch[0],
        y_input: mnist_batch[1]
    })
    print(loss_value)
tf.summary.FileWriter('./tmp/MNIST',session.graph)
session.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08508732646663682, 'fraction_numerical': 0.00761307657859382, 'mean_word_length': 5.8318042813455655, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '377806', 'license': 'Apache-2.0', 'n_tokens_mistral': 758, 'n_tokens_neox': 775, 'n_words': 210, 'path': 'book_computer_vision/ch02_MNIST.ipynb', 'repo_name': 'ideptor/python', 'size': '2233'}