code: def from_grid(
      cls,
      grid: Sequence[Sequence[str]],
      max_horizon: int = -1,
      use_taxicab_reward: bool = False,
  ):
      size = (len(grid), len(grid[0]))
      start = (0, 0)
      goal = (0, 0)
      walls = []
      for x, r in enumerate(grid):
          for y, c in enumerate(r):
              g = c.lower()
              if g == "s":
                  start = (x, y)
              elif g == "g":
                  goal = (x, y)
              elif g == "w":
                  walls += ((x, y),)
      return cls(
          size, start, goal, max_horizon, walls, use_taxicab_reward
      )
  
imports: import logging
  import random
  from typing import Iterable, Optional, Sequence, Tuple
  import numpy
  import torch
  from reagent.ope.estimators.sequential_estimators import DMEstimator, DoublyRobustEstimator, EpsilonGreedyRLPolicy, IPSEstimator, MAGICEstimator, NeuralDualDICE, RewardProbability, RLEstimatorInput, State, StateDistribution, StateReward, ValueFunction
  from reagent.ope.estimators.types import Action, ActionSpace
  from reagent.ope.test.envs import Environment, PolicyLogGenerator
  from reagent.ope.trainers.rl_tabular_trainers import DPTrainer, DPValueFunction, EstimatedStateValueFunction, TabularPolicy
label_desc: Use image node_id 2 for calling the GridWorld obj's underlying member method code with example usage: obj.from_grid(cls, grid, max_horizon, use_taxicab_reward) and returns: cls