def patch(self, name, pytorchjob, namespace=None):
    """
    Patch existing pytorchjob
    :param name: existing pytorchjob name
    :param pytorchjob: patched pytorchjob
    :param namespace: defaults to current or default namespace
    :return: patched pytorchjob
    """
    if namespace is None:
      namespace = utils.set_pytorchjob_namespace(pytorchjob)

    try:
      outputs = self.api_instance.patch_namespaced_custom_object(
        constants.PYTORCHJOB_GROUP,
        constants.PYTORCHJOB_VERSION,
        namespace,
        constants.PYTORCHJOB_PLURAL,
        name,
        pytorchjob)
    except client.rest.ApiException as e:
      raise RuntimeError(
        "Exception when calling CustomObjectsApi->patch_namespaced_custom_object:\
         %s\n" % e)

    return outputs
    def create(self, pytorchjob, namespace=None):
        """
    Create the PyTorchJob
    :param pytorchjob: pytorchjob object
    :param namespace: defaults to current or default namespace
    :return: created pytorchjob
    """

        if namespace is None:
            namespace = utils.set_pytorchjob_namespace(pytorchjob)

        try:
            outputs = self.custom_api.create_namespaced_custom_object(
                constants.PYTORCHJOB_GROUP, constants.PYTORCHJOB_VERSION,
                namespace, constants.PYTORCHJOB_PLURAL, pytorchjob)
        except client.rest.ApiException as e:
            raise RuntimeError(
                "Exception when calling CustomObjectsApi->create_namespaced_custom_object:\
         %s\n" % e)

        return outputs