Save the model to a in memory buffer represetation

        Returns
        -------
        a in memory buffer represetation of the model
198328
def save_raw(self):
        
        length = ctypes.c_ulong()
        cptr = ctypes.POINTER(ctypes.c_char)()
        _check_call(_LIB.XGBoosterGetModelRaw(self.handle,
                                              ctypes.byref(length),
                                              ctypes.byref(cptr)))
        return ctypes2buffer(cptr, length.value)
1337973
def export_model(self):
        

        with self.graph.as_default():
            target_nodes = ','.join(self._process_graph())
            ckpt = tf.train.get_checkpoint_state(self.model_path)
            freeze_graph.freeze_graph(
                input_graph=self.model_path + '/raw_graph_def.pb',
                input_binary=True,
                input_checkpoint=ckpt.model_checkpoint_path,
                output_node_names=target_nodes,
                output_graph=(self.model_path + '/frozen_graph_def.pb'),
                clear_devices=True, initializer_nodes='', input_saver='',
                restore_op_name='save/restore_all',
                filename_tensor_name='save/Const:0')

        tf2bc.convert(self.model_path + '/frozen_graph_def.pb', self.model_path + '.nn')
        logger.info('Exported ' + self.model_path + '.nn file')
879207
def save(self, target, storage=None, **options):
        

        # Save (tabulator)
        if storage is None:
            with Stream(self.iter, headers=self.__schema.headers) as stream:
                stream.save(target, **options)
            return True

        # Save (storage)
        else:
            if not isinstance(storage, Storage):
                storage = Storage.connect(storage, **options)
            storage.create(target, self.__schema.descriptor, force=True)
            storage.write(target, self.iter(cast=False))
            return storage
906048
def to_buffer(self):
        
        value = self._transform_value()
        if self._fastpath != _FASTPATH_NUMPY:
            bit_length = self.itemsize_bits * self._num_elements()
            out = bytearray((bit_length + 7) // 8)
            gen = self._write_bits(out)
            gen.send(None)  # Initialise the generator
            # If it's a scalar, unpack it. That way, the input to the
            # final level of recursion in _store_recursive is always
            # the scalar rather than the 0D array.
            if len(self.shape) == 0:
                value = value[()]
            self._store_recursive(len(self.shape), value, gen)
            gen.close()
            return out
        else:
            if self.order == 'F':
                # numpy doesn't allow buffer protocol to be used on arrays that
                # aren't C-contiguous, but transposition just fiddles the
                # strides of the view without creating a new array.
                value = value.transpose()
            return value
904452
def save_to_object(self):
        

        tmpdir = tempfile.mkdtemp("save_to_object", dir=self.logdir)
        checkpoint_prefix = self.save(tmpdir)

        data = {}
        base_dir = os.path.dirname(checkpoint_prefix)
        for path in os.listdir(base_dir):
            path = os.path.join(base_dir, path)
            if path.startswith(checkpoint_prefix):
                with open(path, "rb") as f:
                    data[os.path.basename(path)] = f.read()

        out = io.BytesIO()
        data_dict = pickle.dumps({
            "checkpoint_name": os.path.basename(checkpoint_prefix),
            "data": data,
        })
        if len(data_dict) > 10e6:  # getting pretty large
            logger.info("Checkpoint size is {} bytes".format(len(data_dict)))
        out.write(data_dict)

        shutil.rmtree(tmpdir)
        return out.getvalue()
940478
def save_model(self, steps):
        
        with self.graph.as_default():
            last_checkpoint = self.model_path + '/model-' + str(steps) + '.cptk'
            self.saver.save(self.sess, last_checkpoint)
            tf.train.write_graph(self.graph, self.model_path,
                                 'raw_graph_def.pb', as_text=False)
366323
public ByteBuffer saveToBuffer(InstanceId instId)
            throws IOException
    {
        if (instId == null) {
            throw new IOException("Null instance ID.");
        }
        if (m_serData == null) {
            throw new IOException("Uninitialized hashinator snapshot data.");
        }

        // Assume config data is the last field.
        ByteBuffer buf = ByteBuffer.allocate(m_serData.length + OFFSET_DATA);

        // Make sure the CRC starts at zero since those bytes figure into the CRC calculation.
        buf.putLong(OFFSET_CRC, 0);
        buf.putInt(OFFSET_INSTID_COORD, instId.getCoord());
        buf.putLong(OFFSET_INSTID_TIMESTAMP, instId.getTimestamp());
        buf.putLong(OFFSET_VERSION, m_version);
        buf.position(OFFSET_DATA);
        buf.put(m_serData);

        // Finalize the CRC based on the entire buffer and reset the current position.
        final PureJavaCrc32 crc = new PureJavaCrc32();
        crc.update(buf.array());
        buf.putLong(OFFSET_CRC, crc.getValue());
        buf.rewind();
        return buf;
    }
652006
def save(self, force_insert=False, force_update=False, using=None,
             update_fields=None):
        
        # Always create a new entry, instead of updating an existing model
        self.pk = None  # pylint: disable=invalid-name
        super(ConfigurationModel, self).save(
            force_insert,
            force_update,
            using,
            update_fields
        )
        cache.delete(self.cache_key_name(*[getattr(self, key) for key in self.KEY_FIELDS]))
        if self.KEY_FIELDS:
            cache.delete(self.key_values_cache_key_name())
1115389
def save(self):
        
        self.get_writer().flush()
        mpc_filename = self.get_writer().get_filename()
        self.get_writer().close()
        self._writer = None
        return mpc_filename
821939
def save(self, *args, **kwargs):
        
        if self.created is None:
            self.created = tz_now()
        
        if self.modified is None:
            self.modified = self.created
            
        super(Thread, self).save(*args, **kwargs)
149228
public static void save() {
        H.Response resp = H.Response.current();

        H.Session session = H.Session.current();
        serialize(session);

        H.Flash flash = H.Flash.current();
        serialize(flash);
    }
871364
def buffer
      model_path = options[:path]

      model_klass = self.class

      new_options = options.merge(path: model_path, save_to: self, buffer: true).reject { |k, _| k.to_sym == :persistor }

      model = nil
      Volt::Model.no_validate do
        model = model_klass.new(attributes, new_options, :loaded)

        model.instance_variable_set('@new', @new)
      end

      model
    end
1138709
def save(self):
        
        data = super().save()
        data['levels'] = self.levels
        if self.parsers is None:
            data['parsers'] = None
        else:
            data['parsers'] = [parser.save() for parser in self.parsers]
        return data
65584
def save(self, obj):
        
        if isinstance(obj, self.np.ndarray) and not obj.dtype.hasobject:
            # Compute a hash of the object
            # The update function of the hash requires a c_contiguous buffer.
            if obj.shape == ():
                # 0d arrays need to be flattened because viewing them as bytes
                # raises a ValueError exception.
                obj_c_contiguous = obj.flatten()
            elif obj.flags.c_contiguous:
                obj_c_contiguous = obj
            elif obj.flags.f_contiguous:
                obj_c_contiguous = obj.T
            else:
                # Cater for non-single-segment arrays: this creates a
                # copy, and thus aleviates this issue.
                # XXX: There might be a more efficient way of doing this
                obj_c_contiguous = obj.flatten()

            # memoryview is not supported for some dtypes, e.g. datetime64, see
            # https://github.com/numpy/numpy/issues/4983. The
            # workaround is to view the array as bytes before
            # taking the memoryview.
            self._hash.update(
                self._getbuffer(obj_c_contiguous.view(self.np.uint8)))

            # We store the class, to be able to distinguish between
            # Objects with the same binary content, but different
            # classes.
            if self.coerce_mmap and isinstance(obj, self.np.memmap):
                # We don't make the difference between memmap and
                # normal ndarrays, to be able to reload previously
                # computed results with memmap.
                klass = self.np.ndarray
            else:
                klass = obj.__class__
            # We also return the dtype and the shape, to distinguish
            # different views on the same data with different dtypes.

            # The object will be pickled by the pickler hashed at the end.
            obj = (klass, ('HASHED', obj.dtype, obj.shape, obj.strides))
        elif isinstance(obj, self.np.dtype):
            # Atomic dtype objects are interned by their default constructor:
            # np.dtype('f8') is np.dtype('f8')
            # This interning is not maintained by a
            # pickle.loads + pickle.dumps cycle, because __reduce__
            # uses copy=True in the dtype constructor. This
            # non-deterministic behavior causes the internal memoizer
            # of the hasher to generate different hash values
            # depending on the history of the dtype object.
            # To prevent the hash from being sensitive to this, we use
            # .descr which is a full (and never interned) description of
            # the array dtype according to the numpy doc.
            klass = obj.__class__
            obj = (klass, ('HASHED', obj.descr))
        Hasher.save(self, obj)
50087
def save(self):
        
        data = super().save()
        data['resize'] = list(self.resize) if self.resize is not None else None
        data['traversal'] = [t.save() for t in self.traversal]
        data['levels'] = self.levels
        data['level_scale'] = self.level_scale
        data['scale'] = self.scale
        return data
446831
def save(self):
        
        with NamedTemporaryFile(
            dir=os.path.dirname(self.storage_path), delete=False
        ) as f:
            # we use protocol=2 for python 2/3 compatibility
            dump(self.data, f, protocol=2)
            f.flush()
            os.fsync(f.fileno())
            tmppath = f.name
        os.rename(tmppath, self.storage_path)
1184054
async def save(self):
        

        if hasattr(self, "before_save"):
            self.before_save()

        query = r.table(self.table_name)

        if self._state.get("id"):
            query = query \
                .get(self._state.get("id")) \
                .update(self.__db_repr, return_changes=True)
        else:
            query = query \
                .insert(self.__db_repr, return_changes=True)

        resp = await query.run(await conn.get())

        try:
            changes = resp["changes"]

            if len(changes) > 0:
                self.wrap(resp["changes"][0]["new_val"])
        except KeyError:
            raise UnexpectedDbResponse()

        if resp["skipped"] > 0:
            raise UnexpectedDbResponse(
                "Model with id `%s` not found in the database." %
                self._state.get("id"))

        return self