在构建蚂蚁期间我遇到了一个问题。 我正在运行以下cmd:
import tensorflow as tf
import numpy as np
from tensorflow.keras.layers import Conv2D, MaxPool2D, Flatten, Dense, Dropout, Input
np.random.seed(1)
tf.set_random_seed(1)
batch_size = 128
NUM_CLASSES = 10
print(tf.__version__)
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
#x_train, x_test = x_train / 255.0, x_test / 255.0 #normalizing
def tfdata_generator(images, labels, is_training, batch_size=128):
'''Construct a data generator using tf.Dataset'''
def preprocess_fn(image, label):
'''A transformation function to preprocess raw data
into trainable input. '''
x = tf.reshape(tf.cast(image, tf.float32), (28, 28, 1))
y = tf.one_hot(tf.cast(label, tf.uint8), NUM_CLASSES)
return x, y
dataset = tf.data.Dataset.from_tensor_slices((images, labels))
if is_training:
dataset = dataset.shuffle(1000) # depends on sample size
# Transform and batch data at the same time
dataset = dataset.apply(tf.contrib.data.map_and_batch(
preprocess_fn, batch_size,
num_parallel_batches=2, # cpu cores
drop_remainder=True if is_training else False))
dataset = dataset.repeat()
dataset = dataset.prefetch(tf.contrib.data.AUTOTUNE)
return dataset
training_set = tfdata_generator(x_train, y_train,is_training=True, batch_size=batch_size)
testing_set = tfdata_generator(x_test, y_test, is_training=False, batch_size=batch_size)
inputs = Input(shape=(28, 28, 1))
x = Conv2D(32, (3, 3), activation='relu', padding='valid')(inputs)
x = MaxPool2D(pool_size=(2, 2))(x)
x = Conv2D(64, (3, 3), activation='relu')(x)
x = MaxPool2D(pool_size=(2, 2))(x)
x = Flatten()(x)
x = Dense(512, activation='relu')(x)
x = Dropout(0.5)(x)
outputs = Dense(NUM_CLASSES, activation='softmax')(x)
keras_model = tf.keras.Model(inputs, outputs)
#Compile the model
keras_model.compile('adam', 'categorical_crossentropy', metrics=['acc'])
#Train with tf.data datasets
keras_training_history = keras_model.fit(
training_set.make_one_shot_iterator(),
steps_per_epoch=len(x_train) // batch_size,
epochs=5,
validation_data=testing_set.make_one_shot_iterator(),
validation_steps=len(x_test) // batch_size,
verbose=1)
print(keras_training_history.history)
运行上述命令后,我面临以下问题。
ant -f build.xml
错误出现在行号532 BUILD FAILED
C:\ptc\Windchill_10.1\Windchill\bin\adminTools\WebServices\common\common-server.
jws_xml:191: The following error occurred while executing this line:
C:\ptc\Windchill_10.1\Windchill\apacheConf\recorder\ApacheWebAppController.xml:3
9: The following error occurred while executing this line:
C:\ptc\Windchill_10.1\Windchill\apacheConf\recorder\ApacheWebAppController.xml:6
2: The following error occurred while executing this line:
C:\ptc\Windchill_10.1\Windchill\apacheConf\recorder\ApacheWebAppController.xml:2
45: The following error occurred while executing this line:
C:\ptc\Windchill_10.1\Windchill\apacheConf\recorder\ApacheWebAppController.xml:2
81: The following error occurred while executing this line:
C:\ptc\Windchill_10.1\Windchill\apacheConf\recorder\ApacheWebAppController.xml:2
67: The following error occurred while executing this line:
C:\ptc\Windchill_10.1\Apache\webAppConfig.xml:178: The following error occurred
while executing this line:
C:\ptc\Windchill_10.1\Apache\webAppConfig.xml:247: The following error occurred
while executing this line:
C:\ptc\Windchill_10.1\Apache\webAppConfig.xml:532: error running fixcrlf on file
C:\ptc\Windchill_10.1\Apache\conf\extra\ajpWorkers.conf
由于某种原因,我无法发布完整的代码。
任何人都可以帮助我,对此我将非常感谢。