code: def from_datasets(
      cls,
      name: str,
      num_trials: int,
      train_set: Dataset,
      test_set: Dataset,
      infer_noise: bool = True,
  ) -> "PyTorchCNNBenchmarkProblem":
      optimal_value = 1
  
      search_space = SearchSpace(
          parameters=[
              RangeParameter(
                  name="lr",
                  parameter_type=ParameterType.FLOAT,
                  lower=1e-6,
                  upper=0.4,
              ),
              RangeParameter(
                  name="momentum",
                  parameter_type=ParameterType.FLOAT,
                  lower=0,
                  upper=1,
              ),
              RangeParameter(
                  name="weight_decay",
                  parameter_type=ParameterType.FLOAT,
                  lower=0,
                  upper=1,
              ),
              RangeParameter(
                  name="step_size",
                  parameter_type=ParameterType.INT,
                  lower=1,
                  upper=100,
              ),
              RangeParameter(
                  name="gamma",
                  parameter_type=ParameterType.FLOAT,
                  lower=0,
                  upper=1,
              ),
          ]
      )
      optimization_config = OptimizationConfig(
          objective=Objective(
              metric=PyTorchCNNMetric(infer_noise=infer_noise),
              minimize=False,
          )
      )
  
      runner = PyTorchCNNRunner(
          name=name, train_set=train_set, test_set=test_set
      )
  
      return cls(
          name=f"HPO_PyTorchCNN_{name}",
          optimal_value=optimal_value,
          search_space=search_space,
          optimization_config=optimization_config,
          runner=runner,
          num_trials=num_trials,
          infer_noise=infer_noise,
      )
  
imports: from typing import Any, Dict, Iterable, Set
  import pandas
  import torch
  from ax.benchmark.benchmark_problem import SingleObjectiveBenchmarkProblem
  from ax.core.base_trial import BaseTrial, TrialStatus
  from ax.core.data import Data
  from ax.core.metric import Metric, MetricFetchE, MetricFetchResult
  from ax.core.objective import Objective
  from ax.core.optimization_config import OptimizationConfig
  from ax.core.parameter import ParameterType, RangeParameter
  from ax.core.runner import Runner
  from ax.core.search_space import SearchSpace
  from ax.utils.common.base import Base
  from ax.utils.common.equality import equality_typechecker
  from ax.utils.common.result import Err, Ok
  from torch import nn, optim
  from torch.nn import functional
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 2 for calling the PyTorchCNNBenchmarkProblem obj's underlying member method code with example usage: obj.from_datasets(cls, name, num_trials, train_set, test_set, infer_noise) and returns: cls