Creates a new Hessian 2.0 serializer.
519155
public Hessian2Output createHessian2Output(OutputStream os)
    {
        Hessian2Output out = createHessian2Output();

        out.init(os);

        return out;
    }
836155
def eval_hessian(self, *args, **kwargs):
        
        # Evaluate the hessian model and use the resulting Ans namedtuple as a
        # dict. From this, take the relevant components.
        eval_hess_dict = self.hessian_model(*args, **kwargs)._asdict()
        hess = [[[np.broadcast_to(eval_hess_dict.get(D(var, p1, p2), 0),
                                  eval_hess_dict[var].shape)
                    for p2 in self.params]
                for p1 in self.params]
            for var in self
        ]
        # Use numpy to broadcast these arrays together and then stack them along
        # the parameter dimension. We do not include the component direction in
        # this, because the components can have independent shapes.
        for idx, comp in enumerate(hess):
            hess[idx] = np.stack(np.broadcast_arrays(*comp))

        Ans = variabletuple('Ans', self.keys())
        return Ans(*hess)
1059980
def hessian(self, x, y, kappa_ext, ra_0=0, dec_0=0):
        
        gamma1 = 0
        gamma2 = 0
        kappa = kappa_ext
        f_xx = kappa + gamma1
        f_yy = kappa - gamma1
        f_xy = gamma2
        return f_xx, f_yy, f_xy
976735
def eval_hessian(self, ordered_parameters=[], **parameters):
        
        result = super(HessianObjectiveJacApprox, self).__call__(
            ordered_parameters, **parameters
        )
        num_params = len(self.model.params)
        return [np.broadcast_to(
                    np.zeros_like(comp),
                    (num_params, num_params) + comp.shape
                ) for comp in result]
471551
public Object readObject(AbstractHessianInput in,
                             String type,
                             String[] fieldNames)
        throws HessianProtocolException, IOException {
        Deserializer deserializer = getDeserializer(type);

        if (deserializer != null)
            return deserializer.readObject(in, fieldNames);
        else if (_hashMapDeserializer != null)
            return _hashMapDeserializer.readObject(in, fieldNames);
        else {
            _hashMapDeserializer = new MapDeserializer(HashMap.class);

            return _hashMapDeserializer.readObject(in, fieldNames);
        }
    }
123426
def create(input_width, input_height, input_channels=1, output_dim=512, initial_std_dev=0.4, factorized_noise=True):
    
    def instantiate(**_):
        return DoubleNoisyNatureCnn(
            input_width=input_width, input_height=input_height, input_channels=input_channels,
            output_dim=output_dim, initial_std_dev=initial_std_dev, factorized_noise=factorized_noise
        )

    return ModelFactory.generic(instantiate)
1021228
public static function create($name)
    {
        $serializerClass = 'Dmishh\\SettingsBundle\\Serializer\\' . Container::camelize($name) . 'Serializer';

        if (class_exists($serializerClass)) {
            return new $serializerClass();
        } else {
            $serializerClass = $name;

            if (class_exists($serializerClass)) {
                $serializer = new $serializerClass();
                if ($serializer instanceof SerializerInterface) {
                    return $serializer;
                }
            }
        }

        throw new UnknownSerializerException($serializerClass);
    }
334746
def build_json_serializer(object, options={})
      ScopedSerializer.for(object, { :scope => serializer_scope, :super => true }.merge(options.merge(default_serializer_options)))
    end
400294
def create(self, request, *args, **kwargs):
        
        serializer = self.get_serializer(data=compat_get_request_data(request))
        compat_serializer_check_is_valid(serializer)
        self.perform_create(request, serializer)
        headers = self.get_success_headers(serializer.data)
        return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
627050
def _initialize_serialization(driver_id, worker=global_worker):
    
    serialization_context = pyarrow.default_serialization_context()
    # Tell the serialization context to use the cloudpickle version that we
    # ship with Ray.
    serialization_context.set_pickle(pickle.dumps, pickle.loads)
    pyarrow.register_torch_serialization_handlers(serialization_context)

    for id_type in ray._raylet._ID_TYPES:
        serialization_context.register_type(
            id_type,
            "{}.{}".format(id_type.__module__, id_type.__name__),
            pickle=True)

    def actor_handle_serializer(obj):
        return obj._serialization_helper(True)

    def actor_handle_deserializer(serialized_obj):
        new_handle = ray.actor.ActorHandle.__new__(ray.actor.ActorHandle)
        new_handle._deserialization_helper(serialized_obj, True)
        return new_handle

    # We register this serializer on each worker instead of calling
    # register_custom_serializer from the driver so that isinstance still
    # works.
    serialization_context.register_type(
        ray.actor.ActorHandle,
        "ray.ActorHandle",
        pickle=False,
        custom_serializer=actor_handle_serializer,
        custom_deserializer=actor_handle_deserializer)

    worker.serialization_context_map[driver_id] = serialization_context

    # Register exception types.
    for error_cls in RAY_EXCEPTION_TYPES:
        register_custom_serializer(
            error_cls,
            use_dict=True,
            local=True,
            driver_id=driver_id,
            class_id=error_cls.__module__ + ". " + error_cls.__name__,
        )
    # Tell Ray to serialize lambdas with pickle.
    register_custom_serializer(
        type(lambda: 0),
        use_pickle=True,
        local=True,
        driver_id=driver_id,
        class_id="lambda")
    # Tell Ray to serialize types with pickle.
    register_custom_serializer(
        type(int),
        use_pickle=True,
        local=True,
        driver_id=driver_id,
        class_id="type")
    # Tell Ray to serialize FunctionSignatures as dictionaries. This is
    # used when passing around actor handles.
    register_custom_serializer(
        ray.signature.FunctionSignature,
        use_dict=True,
        local=True,
        driver_id=driver_id,
        class_id="ray.signature.FunctionSignature")
348773
public Hessian2StreamingOutput createHessian2StreamingOutput(OutputStream os)
    {
        Hessian2Output out = createHessian2Output(os);

        return new Hessian2StreamingOutput(out);
    }
1350355
def create(cls, serializable_instance):
    """"""
    if not Serializable.is_serializable(serializable_instance):
      raise ValueError('Can only create pickles for Serializable objects, given {} of type {}'
                       .format(serializable_instance, type(serializable_instance).__name__))
    return cls(unpickle_func=_unpickle_serializable,
               args=(type(serializable_instance), serializable_instance._asdict()))
48005
protected Deserializer getCustomDeserializer(Class cl) {
        try {
            Class serClass = Class.forName(cl.getName() + "HessianDeserializer",
                false, cl.getClassLoader());

            Deserializer ser = (Deserializer) serClass.newInstance();

            return ser;
        } catch (ClassNotFoundException e) {
            log.log(Level.FINEST, e.toString(), e);

            return null;
        } catch (Exception e) {
            log.log(Level.FINE, e.toString(), e);

            return null;
        }
    }
747693
public static function createSerializer()
    {
        $encoders = array(new XmlEncoder(), new JsonEncoder(), new LtsvEncoder());
        $normalizers = array(new GetSetMethodNormalizer());

        return new Serializer($normalizers, $encoders);
    }
1312807
function Serializer () {
  var self = this, args = fun(arguments);

  self.klass = self.klass || Serializer;

  self.options = Object.merge(self.klass.defaults.options, args.objects()[0] || {}, true);
  self.engine = null;
  self.binary = false;
}
746557
public static <T> OptionalJsonSerializer<T> newInstance( JsonSerializer<T> serializer ) {
        return new OptionalJsonSerializer<T>( serializer );
    }
1116605
public static <T> ImmutableMultisetJsonDeserializer<T> newInstance( JsonDeserializer<T> deserializer ) {
        return new ImmutableMultisetJsonDeserializer<T>( deserializer );
    }