What is the default execution mode in TensorFlow 2.x?
Graph Execution
Eager Execution
Lazy Execution
XLA Execution
正解と解説を見る
正解: Eager Execution
TensorFlow 2.x defaults to Eager Execution, which runs operations immediately as Python statements are called. This improves debuggability and makes TF behave more like standard Python. 題は「What is the default execution mode in TensorFlow 2.x?」。
Gradients must be zeroed before computing new ones to prevent accumulation from previous steps. Then loss.backward() computes gradients and optimizer.step() updates the weights. 題は「In PyTorch, what is the correct order of steps in a standard training loop?」。
Which PyTorch method sets a model into evaluation mode?
model.freeze()
model.predict()
model.eval()
model.inference()
正解と解説を見る
正解: model.eval()
model.eval() disables Dropout and switches BatchNorm to use running statistics instead of batch statistics. It should be paired with torch.no_grad() to also disable gradient tracking during inference. 題は「Which PyTorch method sets a model into evaluation mode?」。
Converts a Python function into a TensorFlow static computation graph for faster execution
Enables GPU memory allocation for a function
Freezes the weights of a model
Automatically tunes the learning rate
正解と解説を見る
正解: Converts a Python function into a TensorFlow static computation graph for faster execution
tf.function() traces the Python function and compiles it into a TensorFlow graph. This reduces Python overhead on repeated calls and enables XLA compilation for speed improvements. 題は「What does tf.function() do in TensorFlow?」。
正解は 1。
選択肢は Converts a Python function into a TensorFlow static computation graph for faster execution, Enables GPU memory allocation for a function, Freezes the weights of a model, Automatically tunes the learning rate。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 5
Which context manager in PyTorch disables gradient computation during inference?
torch.no_grad()
torch.disable_grad()
torch.grad_off()
torch.inference()
正解と解説を見る
正解: torch.no_grad()
torch.no_grad() prevents PyTorch from tracking operations for autograd, reducing memory usage and computation cost. It is typically used together with model.eval() during inference. 題は「Which context manager in PyTorch disables gradient computation during inference?」。
What is the purpose of tf.GradientTape in TensorFlow?
To record operations for automatic differentiation and manually compute gradients
To visualize the model architecture
To schedule the learning rate automatically
To save model checkpoints during training
正解と解説を見る
正解: To record operations for automatic differentiation and manually compute gradients
tf.GradientTape records operations executed inside its context. Calling tape.gradient(loss, variables) computes the gradients of loss with respect to those variables. It is essential for custom training loops. 題は「What is the purpose of tf.GradientTape in TensorFlow?」。
正解は 1。
選択肢は To record operations for automatic differentiation and manually compute gradients, To visualize the model architecture, To schedule the learning rate automatically, To save model checkpoints during training。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 7
Which Keras method saves only the weights of a model?
model.save('path')
model.export('path')
model.save_weights('path')
tf.saved_model.save(model, 'path')
正解と解説を見る
正解: model.save_weights('path')
model.save_weights() stores only the weight values. model.save() stores the full model including architecture and optimizer state. Saving weights alone is useful when the architecture is defined separately. 題は「Which Keras method saves only the weights of a model?」。
In PyTorch, what is the primary purpose of increasing num_workers in DataLoader?
To increase the model parameter count
To parallelize data loading across CPU processes and reduce GPU idle time
To automatically increase the batch size
To enable multi-GPU training
正解と解説を見る
正解: To parallelize data loading across CPU processes and reduce GPU idle time
num_workers specifies how many subprocesses are used for data loading. A higher value allows data to be prepared in parallel while the GPU is busy with the previous batch, reducing the data bottleneck. 題は「In PyTorch, what is the primary purpose of increasing num_workers in DataLoader?」。
正解は 2。
選択肢は To increase the model parameter count, To parallelize data loading across CPU processes and reduce GPU idle time, To automatically increase the batch size, To enable multi-GPU training。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 9
What is the main advantage of PyTorch's dynamic computation graph compared to TensorFlow 1.x's static graph?
It always uses less memory
It allows the graph to be modified at runtime enabling flexible debugging
It runs faster on CPU without any configuration
It automatically optimizes the model architecture
正解と解説を見る
正解: It allows the graph to be modified at runtime enabling flexible debugging
PyTorch builds the computation graph dynamically as operations execute (Define-by-Run). This allows standard Python control flow and makes debugging with tools like pdb straightforward. 題は「What is the main advantage of PyTorch's dynamic computation graph compared to Te」。
正解は 2。
選択肢は It always uses less memory, It allows the graph to be modified at runtime enabling flexible debugging, It runs faster on CPU without any configuration, It automatically optimizes the model architecture。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 10
In Keras, which three arguments are required when calling model.compile()?
optimizer / loss / metrics
layers / activations / dropout
batch_size / epochs / shuffle
input_shape / output_shape / units
正解と解説を見る
正解: optimizer / loss / metrics
model.compile() configures the model for training. optimizer specifies the update rule, loss defines the objective function, and metrics lists the evaluation criteria tracked during training and validation. 題は「In Keras, which three arguments are required when calling model.compile()?」。
Which method must be implemented when subclassing torch.nn.Module in PyTorch?
run()
call()
forward()
compute()
正解と解説を見る
正解: forward()
The forward() method defines the computation performed at every call. PyTorch's autograd engine automatically derives the backward pass from the operations recorded in forward(). 題は「Which method must be implemented when subclassing torch.nn.Module in PyTorch?」。
正解は 3。
選択肢は run(), call(), forward(), compute()。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 12
model.train() in PyTorch enables training-specific behavior in layers such as Dropout and BatchNorm.
正解と解説を見る
正解: true
model.train() sets the model to training mode, enabling stochastic Dropout and batch-level statistics in BatchNorm. This is the counterpart to model.eval() used during inference. 題は「model.train() in PyTorch enables training-specific behavior in layers such as Dr」。
正解は true。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 13
The Keras Functional API supports only sequential (linear) model architectures.
正解と解説を見る
正解: false
The Keras Functional API supports arbitrary DAG (Directed Acyclic Graph) architectures including multi-input, multi-output, and shared-layer models. Only the Sequential API is limited to linear stacks. 題は「The Keras Functional API supports only sequential (linear) model architectures.」。
正解は false。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 14
torch.no_grad() and model.eval() have identical effects on a PyTorch model.
正解と解説を見る
正解: false
model.eval() changes the behavior of layers such as Dropout and BatchNorm. torch.no_grad() disables gradient tracking to save memory and compute. Both are needed together for correct inference. 題は「torch.no_grad() and model.eval() have identical effects on a PyTorch model.」。
正解は false。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 15
What Python class must be subclassed to define a custom model in PyTorch?
正解と解説を見る
正解: torch.nn.Module
All custom models and layers in PyTorch are defined by subclassing torch.nn.Module and implementing the __init__() and forward() methods. 題は「What Python class must be subclassed to define a custom model in PyTorch?」。
正解は torch.nn.Module。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 16
What is the name of the TensorFlow Keras API used to build models by stacking layers linearly?
正解と解説を見る
正解: Sequential
tf.keras.Sequential allows building models by passing a list of layers or calling model.add(). It is limited to single-input single-output linear stacks of layers. 題は「What is the name of the TensorFlow Keras API used to build models by stacking la」。
正解は Sequential。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 17
Which PyTorch class implements the Adam optimization algorithm?
正解と解説を見る
正解: torch.optim.Adam
torch.optim.Adam implements the Adam optimizer, combining momentum and RMSProp-style per-parameter adaptive learning rates for efficient gradient-based optimization. 題は「Which PyTorch class implements the Adam optimization algorithm?」。
正解は torch.optim.Adam。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 18
Which PyTorch loss function is correct for binary classification with sigmoid output?
torch.nn.CrossEntropyLoss()
torch.nn.BCELoss()
torch.nn.NLLLoss()
torch.nn.MSELoss()
正解と解説を見る
正解: torch.nn.BCELoss()
BCELoss computes binary cross-entropy between the target and a predicted probability in [0, 1]. The model output must first pass through a sigmoid. BCEWithLogitsLoss combines sigmoid and BCE in one numerically stable operation.
問 19
What does tf.keras.callbacks.EarlyStopping do during training?
Stops training when the monitored metric stops improving
Reduces the learning rate after every epoch
Saves the model weights after each epoch
Terminates training after a fixed number of steps
正解と解説を見る
正解: Stops training when the monitored metric stops improving
EarlyStopping monitors a metric such as val_loss and halts training when it fails to improve for a specified number of epochs (patience). This prevents overfitting and unnecessary computation. 題は「What does tf.keras.callbacks.EarlyStopping do during training?」。
正解は 1。
選択肢は Stops training when the monitored metric stops improving, Reduces the learning rate after every epoch, Saves the model weights after each epoch, Terminates training after a fixed number of steps。
カテゴリ DL の用語と、隣の分野の用語を取り違えない。
誤答は「近いが役割が違うサービス/手法/品詞」になっていることが多い。
問 20
What interface must be implemented when subclassing torch.utils.data.Dataset?
__init__ and __call__
__len__ and __getitem__
__iter__ and __next__
__size__ and __fetch__
正解と解説を見る
正解: __len__ and __getitem__
__len__ returns the total number of samples and __getitem__ returns the sample at a given index. The resulting Dataset object is passed to DataLoader for batching, shuffling, and parallel loading. 題は「What interface must be implemented when subclassing torch.utils.data.Dataset?」。
正解は 2。
選択肢は __init__ and __call__, __len__ and __getitem__, __iter__ and __next__, __size__ and __fetch__。