Write the validate_environment and update_torch_dtype methods.