裁剪¶
- 類 torchrl.envs.transforms.Crop(w: int, h: int = None, top: int = 0, left: int = 0, in_keys: Sequence[NestedKey] | None = None, out_keys: Sequence[NestedKey] | None = None)[原始碼]¶
在指定位置和輸出尺寸處裁剪輸入影像。
- 引數:
w (int) – 結果寬度
h (int, 可選) – 結果高度。如果為 None,則使用 w(正方形裁剪)。
top (int, 可選) – 開始裁剪的頂部畫素座標。預設為 0,即影像頂部。
left (int, 可選) – 開始裁剪的左側畫素座標。預設為 0,即影像左側。
in_keys (NestedKey 序列, 可選) – 要裁剪的條目。如果未提供,則假定為
["pixels"]。out_keys (NestedKey 序列, 可選) – 裁剪後圖像的鍵。如果未提供,則假定為
in_keys。
- transform_observation_spec(observation_spec: TensorSpec) TensorSpec[原始碼]¶
變換觀察規範,使結果規範與變換對映匹配。
- 引數:
observation_spec (TensorSpec) – 變換前的規範
- 返回:
變換後的預期規範