partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
Layer.freeze
freeze module, if names is not None, set an array of layers that match given names to be freezed :param names: an array of layer names :return:
pyspark/bigdl/nn/layer.py
def freeze(self, names=None): """ freeze module, if names is not None, set an array of layers that match given names to be freezed :param names: an array of layer names :return: """ callBigDlFunc(self.bigdl_type, "freeze", self.value, names) return self
def freeze(self, names=None): """ freeze module, if names is not None, set an array of layers that match given names to be freezed :param names: an array of layer names :return: """ callBigDlFunc(self.bigdl_type, "freeze", self.value, names) return self
[ "freeze", "module", "if", "names", "is", "not", "None", "set", "an", "array", "of", "layers", "that", "match", "given", "names", "to", "be", "freezed", ":", "param", "names", ":", "an", "array", "of", "layer", "names", ":", "return", ":" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L576-L584
[ "def", "freeze", "(", "self", ",", "names", "=", "None", ")", ":", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"freeze\"", ",", "self", ".", "value", ",", "names", ")", "return", "self" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
Layer.unfreeze
unfreeze module, if names is not None, unfreeze layers that match given names :param names: an array of layer names :return:
pyspark/bigdl/nn/layer.py
def unfreeze(self, names=None): """ unfreeze module, if names is not None, unfreeze layers that match given names :param names: an array of layer names :return: """ callBigDlFunc(self.bigdl_type, "unFreeze", self.value, names) return self
def unfreeze(self, names=None): """ unfreeze module, if names is not None, unfreeze layers that match given names :param names: an array of layer names :return: """ callBigDlFunc(self.bigdl_type, "unFreeze", self.value, names) return self
[ "unfreeze", "module", "if", "names", "is", "not", "None", "unfreeze", "layers", "that", "match", "given", "names", ":", "param", "names", ":", "an", "array", "of", "layer", "names", ":", "return", ":" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L586-L593
[ "def", "unfreeze", "(", "self", ",", "names", "=", "None", ")", ":", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"unFreeze\"", ",", "self", ".", "value", ",", "names", ")", "return", "self" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
Layer.training
Set this layer in the training mode or in predition mode if is_training=False
pyspark/bigdl/nn/layer.py
def training(self, is_training=True): ''' Set this layer in the training mode or in predition mode if is_training=False ''' if is_training: callJavaFunc(self.value.training) else: callJavaFunc(self.value.evaluate) return self
def training(self, is_training=True): ''' Set this layer in the training mode or in predition mode if is_training=False ''' if is_training: callJavaFunc(self.value.training) else: callJavaFunc(self.value.evaluate) return self
[ "Set", "this", "layer", "in", "the", "training", "mode", "or", "in", "predition", "mode", "if", "is_training", "=", "False" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L595-L603
[ "def", "training", "(", "self", ",", "is_training", "=", "True", ")", ":", "if", "is_training", ":", "callJavaFunc", "(", "self", ".", "value", ".", "training", ")", "else", ":", "callJavaFunc", "(", "self", ".", "value", ".", "evaluate", ")", "return", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Layer.quantize
Clone self and quantize it, at last return a new quantized model. :return: A new quantized model. >>> fc = Linear(4, 2) creating: createLinear >>> fc.set_weights([np.ones((2, 4)), np.ones((2,))]) >>> input = np.ones((2, 4)) >>> output = fc.forward(input) >>> expe...
pyspark/bigdl/nn/layer.py
def quantize(self): ''' Clone self and quantize it, at last return a new quantized model. :return: A new quantized model. >>> fc = Linear(4, 2) creating: createLinear >>> fc.set_weights([np.ones((2, 4)), np.ones((2,))]) >>> input = np.ones((2, 4)) >>> out...
def quantize(self): ''' Clone self and quantize it, at last return a new quantized model. :return: A new quantized model. >>> fc = Linear(4, 2) creating: createLinear >>> fc.set_weights([np.ones((2, 4)), np.ones((2,))]) >>> input = np.ones((2, 4)) >>> out...
[ "Clone", "self", "and", "quantize", "it", "at", "last", "return", "a", "new", "quantized", "model", ".", ":", "return", ":", "A", "new", "quantized", "model", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L620-L668
[ "def", "quantize", "(", "self", ")", ":", "quantized_model", "=", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"quantize\"", ",", "self", ".", "value", ")", "return", "Layer", ".", "of", "(", "quantized_model", ")" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.loadModel
Load a pre-trained Bigdl model. :param path: The path containing the pre-trained model. :return: A pre-trained model.
pyspark/bigdl/nn/layer.py
def loadModel(modelPath, weightPath =None, bigdl_type="float"): """ Load a pre-trained Bigdl model. :param path: The path containing the pre-trained model. :return: A pre-trained model. """ jmodel = callBigDlFunc(bigdl_type, "loadBigDLModule", modelPath, weightPath) ...
def loadModel(modelPath, weightPath =None, bigdl_type="float"): """ Load a pre-trained Bigdl model. :param path: The path containing the pre-trained model. :return: A pre-trained model. """ jmodel = callBigDlFunc(bigdl_type, "loadBigDLModule", modelPath, weightPath) ...
[ "Load", "a", "pre", "-", "trained", "Bigdl", "model", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L761-L769
[ "def", "loadModel", "(", "modelPath", ",", "weightPath", "=", "None", ",", "bigdl_type", "=", "\"float\"", ")", ":", "jmodel", "=", "callBigDlFunc", "(", "bigdl_type", ",", "\"loadBigDLModule\"", ",", "modelPath", ",", "weightPath", ")", "return", "Layer", "."...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.load_torch
Load a pre-trained Torch model. :param path: The path containing the pre-trained model. :return: A pre-trained model.
pyspark/bigdl/nn/layer.py
def load_torch(path, bigdl_type="float"): """ Load a pre-trained Torch model. :param path: The path containing the pre-trained model. :return: A pre-trained model. """ jmodel = callBigDlFunc(bigdl_type, "loadTorch", path) return Layer.of(jmodel)
def load_torch(path, bigdl_type="float"): """ Load a pre-trained Torch model. :param path: The path containing the pre-trained model. :return: A pre-trained model. """ jmodel = callBigDlFunc(bigdl_type, "loadTorch", path) return Layer.of(jmodel)
[ "Load", "a", "pre", "-", "trained", "Torch", "model", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L772-L780
[ "def", "load_torch", "(", "path", ",", "bigdl_type", "=", "\"float\"", ")", ":", "jmodel", "=", "callBigDlFunc", "(", "bigdl_type", ",", "\"loadTorch\"", ",", "path", ")", "return", "Layer", ".", "of", "(", "jmodel", ")" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.load_keras
Load a pre-trained Keras model. :param json_path: The json path containing the keras model definition. :param hdf5_path: The HDF5 path containing the pre-trained keras model weights with or without the model architecture. :return: A bigdl model.
pyspark/bigdl/nn/layer.py
def load_keras(json_path=None, hdf5_path=None, by_name=False): """ Load a pre-trained Keras model. :param json_path: The json path containing the keras model definition. :param hdf5_path: The HDF5 path containing the pre-trained keras model weights with or without the model architecture...
def load_keras(json_path=None, hdf5_path=None, by_name=False): """ Load a pre-trained Keras model. :param json_path: The json path containing the keras model definition. :param hdf5_path: The HDF5 path containing the pre-trained keras model weights with or without the model architecture...
[ "Load", "a", "pre", "-", "trained", "Keras", "model", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L783-L810
[ "def", "load_keras", "(", "json_path", "=", "None", ",", "hdf5_path", "=", "None", ",", "by_name", "=", "False", ")", ":", "import", "os", "try", ":", "import", "tensorflow", "except", "ImportError", ":", "os", ".", "environ", "[", "'KERAS_BACKEND'", "]", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.load_caffe
Load a pre-trained Caffe model. :param model: A bigdl model definition \which equivalent to the pre-trained caffe model. :param defPath: The path containing the caffe model definition. :param modelPath: The path containing the pre-trained caffe model. :return: A pre-trained model.
pyspark/bigdl/nn/layer.py
def load_caffe(model, defPath, modelPath, match_all=True, bigdl_type="float"): """ Load a pre-trained Caffe model. :param model: A bigdl model definition \which equivalent to the pre-trained caffe model. :param defPath: The path containing the caffe model definition. :param mod...
def load_caffe(model, defPath, modelPath, match_all=True, bigdl_type="float"): """ Load a pre-trained Caffe model. :param model: A bigdl model definition \which equivalent to the pre-trained caffe model. :param defPath: The path containing the caffe model definition. :param mod...
[ "Load", "a", "pre", "-", "trained", "Caffe", "model", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L813-L824
[ "def", "load_caffe", "(", "model", ",", "defPath", ",", "modelPath", ",", "match_all", "=", "True", ",", "bigdl_type", "=", "\"float\"", ")", ":", "jmodel", "=", "callBigDlFunc", "(", "bigdl_type", ",", "\"loadCaffe\"", ",", "model", ",", "defPath", ",", "...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.load_caffe_model
Load a pre-trained Caffe model. :param defPath: The path containing the caffe model definition. :param modelPath: The path containing the pre-trained caffe model. :return: A pre-trained model.
pyspark/bigdl/nn/layer.py
def load_caffe_model(defPath, modelPath, bigdl_type="float"): """ Load a pre-trained Caffe model. :param defPath: The path containing the caffe model definition. :param modelPath: The path containing the pre-trained caffe model. :return: A pre-trained model. """ ...
def load_caffe_model(defPath, modelPath, bigdl_type="float"): """ Load a pre-trained Caffe model. :param defPath: The path containing the caffe model definition. :param modelPath: The path containing the pre-trained caffe model. :return: A pre-trained model. """ ...
[ "Load", "a", "pre", "-", "trained", "Caffe", "model", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L827-L837
[ "def", "load_caffe_model", "(", "defPath", ",", "modelPath", ",", "bigdl_type", "=", "\"float\"", ")", ":", "jmodel", "=", "callBigDlFunc", "(", "bigdl_type", ",", "\"loadCaffeModel\"", ",", "defPath", ",", "modelPath", ")", "return", "Layer", ".", "of", "(", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.load_tensorflow
Load a pre-trained Tensorflow model. :param path: The path containing the pre-trained model. :param inputs: The input node of this graph :param outputs: The output node of this graph :param byte_order: byte_order of the file, `little_endian` or `big_endian` :param bin_file: the o...
pyspark/bigdl/nn/layer.py
def load_tensorflow(path, inputs, outputs, byte_order = "little_endian", bin_file = None, generated_backward = True, bigdl_type = "float"): """ Load a pre-trained Tensorflow model. :param path: The path containing the pre-trained model. :param inputs: The input no...
def load_tensorflow(path, inputs, outputs, byte_order = "little_endian", bin_file = None, generated_backward = True, bigdl_type = "float"): """ Load a pre-trained Tensorflow model. :param path: The path containing the pre-trained model. :param inputs: The input no...
[ "Load", "a", "pre", "-", "trained", "Tensorflow", "model", ".", ":", "param", "path", ":", "The", "path", "containing", "the", "pre", "-", "trained", "model", ".", ":", "param", "inputs", ":", "The", "input", "node", "of", "this", "graph", ":", "param"...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L840-L854
[ "def", "load_tensorflow", "(", "path", ",", "inputs", ",", "outputs", ",", "byte_order", "=", "\"little_endian\"", ",", "bin_file", "=", "None", ",", "generated_backward", "=", "True", ",", "bigdl_type", "=", "\"float\"", ")", ":", "jmodel", "=", "callBigDlFun...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.stop_gradient
stop the input gradient of layers that match the given ```names``` their input gradient are not computed. And they will not contributed to the input gradient computation of layers that depend on them. :param stop_layers: an array of layer names :param bigdl_type: :return...
pyspark/bigdl/nn/layer.py
def stop_gradient(self, stop_layers, bigdl_type="float"): """ stop the input gradient of layers that match the given ```names``` their input gradient are not computed. And they will not contributed to the input gradient computation of layers that depend on them. :param st...
def stop_gradient(self, stop_layers, bigdl_type="float"): """ stop the input gradient of layers that match the given ```names``` their input gradient are not computed. And they will not contributed to the input gradient computation of layers that depend on them. :param st...
[ "stop", "the", "input", "gradient", "of", "layers", "that", "match", "the", "given", "names", "their", "input", "gradient", "are", "not", "computed", ".", "And", "they", "will", "not", "contributed", "to", "the", "input", "gradient", "computation", "of", "la...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L870-L881
[ "def", "stop_gradient", "(", "self", ",", "stop_layers", ",", "bigdl_type", "=", "\"float\"", ")", ":", "callBigDlFunc", "(", "bigdl_type", ",", "\"setStopGradient\"", ",", "self", ".", "value", ",", "stop_layers", ")", "return", "self" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.node
Return the corresponding node has the given name. If the given name doesn't match any node, an exception will be thrown :param name: node name :param bigdl_type: :return:
pyspark/bigdl/nn/layer.py
def node(self, name, bigdl_type="float"): """ Return the corresponding node has the given name. If the given name doesn't match any node, an exception will be thrown :param name: node name :param bigdl_type: :return: """ jnode = callBigDlFunc(bigdl_type,...
def node(self, name, bigdl_type="float"): """ Return the corresponding node has the given name. If the given name doesn't match any node, an exception will be thrown :param name: node name :param bigdl_type: :return: """ jnode = callBigDlFunc(bigdl_type,...
[ "Return", "the", "corresponding", "node", "has", "the", "given", "name", ".", "If", "the", "given", "name", "doesn", "t", "match", "any", "node", "an", "exception", "will", "be", "thrown", ":", "param", "name", ":", "node", "name", ":", "param", "bigdl_t...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L883-L892
[ "def", "node", "(", "self", ",", "name", ",", "bigdl_type", "=", "\"float\"", ")", ":", "jnode", "=", "callBigDlFunc", "(", "bigdl_type", ",", "\"findGraphNode\"", ",", "self", ".", "value", ",", "name", ")", "return", "Node", ".", "of", "(", "jnode", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Model.save_graph_topology
save current model graph to a folder, which can be display in tensorboard by running tensorboard --logdir logPath :param log_path: path to save the model graph :param bigdl_type: :return:
pyspark/bigdl/nn/layer.py
def save_graph_topology(self, log_path, bigdl_type="float"): """ save current model graph to a folder, which can be display in tensorboard by running tensorboard --logdir logPath :param log_path: path to save the model graph :param bigdl_type: :return: """ ...
def save_graph_topology(self, log_path, bigdl_type="float"): """ save current model graph to a folder, which can be display in tensorboard by running tensorboard --logdir logPath :param log_path: path to save the model graph :param bigdl_type: :return: """ ...
[ "save", "current", "model", "graph", "to", "a", "folder", "which", "can", "be", "display", "in", "tensorboard", "by", "running", "tensorboard", "--", "logdir", "logPath", ":", "param", "log_path", ":", "path", "to", "save", "the", "model", "graph", ":", "p...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/layer.py#L894-L903
[ "def", "save_graph_topology", "(", "self", ",", "log_path", ",", "bigdl_type", "=", "\"float\"", ")", ":", "callBigDlFunc", "(", "bigdl_type", ",", "\"saveGraphTopology\"", ",", "self", ".", "value", ",", "log_path", ")", "return", "self" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
Criterion.forward
NB: It's for debug only, please use optimizer.optimize() in production. Takes an input object, and computes the corresponding loss of the criterion, compared with `target` :param input: ndarray or list of ndarray :param target: ndarray or list of ndarray :return: value of loss
pyspark/bigdl/nn/criterion.py
def forward(self, input, target): """ NB: It's for debug only, please use optimizer.optimize() in production. Takes an input object, and computes the corresponding loss of the criterion, compared with `target` :param input: ndarray or list of ndarray :param target: ndarr...
def forward(self, input, target): """ NB: It's for debug only, please use optimizer.optimize() in production. Takes an input object, and computes the corresponding loss of the criterion, compared with `target` :param input: ndarray or list of ndarray :param target: ndarr...
[ "NB", ":", "It", "s", "for", "debug", "only", "please", "use", "optimizer", ".", "optimize", "()", "in", "production", ".", "Takes", "an", "input", "object", "and", "computes", "the", "corresponding", "loss", "of", "the", "criterion", "compared", "with", "...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/criterion.py#L44-L63
[ "def", "forward", "(", "self", ",", "input", ",", "target", ")", ":", "jinput", ",", "input_is_table", "=", "Layer", ".", "check_input", "(", "input", ")", "jtarget", ",", "target_is_table", "=", "Layer", ".", "check_input", "(", "target", ")", "output", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
Criterion.of
Create a python Criterion by a java criterion object :param jcriterion: A java criterion object which created by Py4j :return: a criterion.
pyspark/bigdl/nn/criterion.py
def of(cls, jcriterion, bigdl_type="float"): """ Create a python Criterion by a java criterion object :param jcriterion: A java criterion object which created by Py4j :return: a criterion. """ criterion = Criterion(bigdl_type, jcriterion) criterion.value = jcrite...
def of(cls, jcriterion, bigdl_type="float"): """ Create a python Criterion by a java criterion object :param jcriterion: A java criterion object which created by Py4j :return: a criterion. """ criterion = Criterion(bigdl_type, jcriterion) criterion.value = jcrite...
[ "Create", "a", "python", "Criterion", "by", "a", "java", "criterion", "object" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/criterion.py#L86-L96
[ "def", "of", "(", "cls", ",", "jcriterion", ",", "bigdl_type", "=", "\"float\"", ")", ":", "criterion", "=", "Criterion", "(", "bigdl_type", ",", "jcriterion", ")", "criterion", ".", "value", "=", "jcriterion", "criterion", ".", "bigdl_type", "=", "bigdl_typ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
DLImageReader.readImages
Read the directory of images into DataFrame from the local or remote source. :param path Directory to the input data files, the path can be comma separated paths as the list of inputs. Wildcards path are supported similarly to sc.binaryFiles(path). :param min_partitions A suggestion valu...
pyspark/bigdl/dlframes/dl_image_reader.py
def readImages(path, sc=None, minParitions = 1, bigdl_type="float"): """ Read the directory of images into DataFrame from the local or remote source. :param path Directory to the input data files, the path can be comma separated paths as the list of inputs. Wildcards path are sup...
def readImages(path, sc=None, minParitions = 1, bigdl_type="float"): """ Read the directory of images into DataFrame from the local or remote source. :param path Directory to the input data files, the path can be comma separated paths as the list of inputs. Wildcards path are sup...
[ "Read", "the", "directory", "of", "images", "into", "DataFrame", "from", "the", "local", "or", "remote", "source", ".", ":", "param", "path", "Directory", "to", "the", "input", "data", "files", "the", "path", "can", "be", "comma", "separated", "paths", "as...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/dlframes/dl_image_reader.py#L31-L42
[ "def", "readImages", "(", "path", ",", "sc", "=", "None", ",", "minParitions", "=", "1", ",", "bigdl_type", "=", "\"float\"", ")", ":", "df", "=", "callBigDlFunc", "(", "bigdl_type", ",", "\"dlReadImage\"", ",", "path", ",", "sc", ",", "minParitions", ")...
e9c19788285986ab789a2e2998f9a85d7524779f
test
WeightLoader.load_weights_from_json_hdf5
The file path can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system.
pyspark/bigdl/keras/converter.py
def load_weights_from_json_hdf5(def_json, weights_hdf5, by_name=False): """ The file path can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. """ bmodel = DefinitionLoader.from_json_path(def_json) def_value = BCommon.text_from_path(def_jso...
def load_weights_from_json_hdf5(def_json, weights_hdf5, by_name=False): """ The file path can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. """ bmodel = DefinitionLoader.from_json_path(def_json) def_value = BCommon.text_from_path(def_jso...
[ "The", "file", "path", "can", "be", "stored", "in", "a", "local", "file", "system", "HDFS", "S3", "or", "any", "Hadoop", "-", "supported", "file", "system", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L54-L63
[ "def", "load_weights_from_json_hdf5", "(", "def_json", ",", "weights_hdf5", ",", "by_name", "=", "False", ")", ":", "bmodel", "=", "DefinitionLoader", ".", "from_json_path", "(", "def_json", ")", "def_value", "=", "BCommon", ".", "text_from_path", "(", "def_json",...
e9c19788285986ab789a2e2998f9a85d7524779f
test
WeightLoader.load_weights_from_hdf5
Loads all layer weights from a HDF5 save file. filepath can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. If `by_name` is False (default) weights are loaded based on the network's execution order topology, meaning layers in the execution seq sho...
pyspark/bigdl/keras/converter.py
def load_weights_from_hdf5(bmodel, kmodel, filepath, by_name=False): '''Loads all layer weights from a HDF5 save file. filepath can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. If `by_name` is False (default) weights are loaded based on the net...
def load_weights_from_hdf5(bmodel, kmodel, filepath, by_name=False): '''Loads all layer weights from a HDF5 save file. filepath can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. If `by_name` is False (default) weights are loaded based on the net...
[ "Loads", "all", "layer", "weights", "from", "a", "HDF5", "save", "file", ".", "filepath", "can", "be", "stored", "in", "a", "local", "file", "system", "HDFS", "S3", "or", "any", "Hadoop", "-", "supported", "file", "system", ".", "If", "by_name", "is", ...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L67-L83
[ "def", "load_weights_from_hdf5", "(", "bmodel", ",", "kmodel", ",", "filepath", ",", "by_name", "=", "False", ")", ":", "local_file_path", "=", "BCommon", ".", "get_local_file", "(", "filepath", ")", "kmodel", ".", "load_weights", "(", "filepath", "=", "local_...
e9c19788285986ab789a2e2998f9a85d7524779f
test
WeightsConverter.get_weights_from_kmodel
Convert kmodel's weights to bigdl format. We are supposing the order is the same as the execution order. :param kmodel: keras model :return: list of ndarray
pyspark/bigdl/keras/converter.py
def get_weights_from_kmodel(kmodel): """ Convert kmodel's weights to bigdl format. We are supposing the order is the same as the execution order. :param kmodel: keras model :return: list of ndarray """ layers_with_weights = [layer for layer in kmodel.layers if lay...
def get_weights_from_kmodel(kmodel): """ Convert kmodel's weights to bigdl format. We are supposing the order is the same as the execution order. :param kmodel: keras model :return: list of ndarray """ layers_with_weights = [layer for layer in kmodel.layers if lay...
[ "Convert", "kmodel", "s", "weights", "to", "bigdl", "format", ".", "We", "are", "supposing", "the", "order", "is", "the", "same", "as", "the", "execution", "order", ".", ":", "param", "kmodel", ":", "keras", "model", ":", "return", ":", "list", "of", "...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L138-L152
[ "def", "get_weights_from_kmodel", "(", "kmodel", ")", ":", "layers_with_weights", "=", "[", "layer", "for", "layer", "in", "kmodel", ".", "layers", "if", "layer", ".", "weights", "]", "bweights", "=", "[", "]", "for", "klayer", "in", "layers_with_weights", "...
e9c19788285986ab789a2e2998f9a85d7524779f
test
DefinitionLoader.__build_node_id_2_klayer
The result would contain all of the layers including nested layers. :param kmodel: a keras model which can be Sequential or Model :param node_id_to_config_layer: a container to store the result
pyspark/bigdl/keras/converter.py
def __build_node_id_2_klayer(kmodel, node_id_to_config_layer): """ The result would contain all of the layers including nested layers. :param kmodel: a keras model which can be Sequential or Model :param node_id_to_config_layer: a container to store the result """ node_id...
def __build_node_id_2_klayer(kmodel, node_id_to_config_layer): """ The result would contain all of the layers including nested layers. :param kmodel: a keras model which can be Sequential or Model :param node_id_to_config_layer: a container to store the result """ node_id...
[ "The", "result", "would", "contain", "all", "of", "the", "layers", "including", "nested", "layers", ".", ":", "param", "kmodel", ":", "a", "keras", "model", "which", "can", "be", "Sequential", "or", "Model", ":", "param", "node_id_to_config_layer", ":", "a",...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L292-L308
[ "def", "__build_node_id_2_klayer", "(", "kmodel", ",", "node_id_to_config_layer", ")", ":", "node_id_to_config_layer", "[", "kmodel", ".", "name", "]", "=", "kmodel", "# include itself as well", "def", "gather_result", "(", "layers", ")", ":", "if", "layers", ":", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
DefinitionLoader.from_hdf5_path
:param hdf5_path: hdf5 path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model
pyspark/bigdl/keras/converter.py
def from_hdf5_path(cls, hdf5_path): """ :param hdf5_path: hdf5 path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model """ from keras.models import load_model hdf5_local_path = BCommon.get_local_file(hdf5_path) ...
def from_hdf5_path(cls, hdf5_path): """ :param hdf5_path: hdf5 path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model """ from keras.models import load_model hdf5_local_path = BCommon.get_local_file(hdf5_path) ...
[ ":", "param", "hdf5_path", ":", "hdf5", "path", "which", "can", "be", "stored", "in", "a", "local", "file", "system", "HDFS", "S3", "or", "any", "Hadoop", "-", "supported", "file", "system", ".", ":", "return", ":", "BigDL", "Model" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L351-L359
[ "def", "from_hdf5_path", "(", "cls", ",", "hdf5_path", ")", ":", "from", "keras", ".", "models", "import", "load_model", "hdf5_local_path", "=", "BCommon", ".", "get_local_file", "(", "hdf5_path", ")", "kmodel", "=", "load_model", "(", "hdf5_local_path", ")", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
DefinitionLoader.from_json_path
:param json_path: definition path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model
pyspark/bigdl/keras/converter.py
def from_json_path(cls, json_path): """ :param json_path: definition path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model """ json_str = BCommon.text_from_path(json_path) return DefinitionLoader.from_json_str...
def from_json_path(cls, json_path): """ :param json_path: definition path which can be stored in a local file system, HDFS, S3, or any Hadoop-supported file system. :return: BigDL Model """ json_str = BCommon.text_from_path(json_path) return DefinitionLoader.from_json_str...
[ ":", "param", "json_path", ":", "definition", "path", "which", "can", "be", "stored", "in", "a", "local", "file", "system", "HDFS", "S3", "or", "any", "Hadoop", "-", "supported", "file", "system", ".", ":", "return", ":", "BigDL", "Model" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/keras/converter.py#L362-L368
[ "def", "from_json_path", "(", "cls", ",", "json_path", ")", ":", "json_str", "=", "BCommon", ".", "text_from_path", "(", "json_path", ")", "return", "DefinitionLoader", ".", "from_json_str", "(", "json_str", ")" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
load_imdb
Load IMDB dataset Transform input data into an RDD of Sample
pyspark/bigdl/examples/keras/imdb_cnn_lstm.py
def load_imdb(): """ Load IMDB dataset Transform input data into an RDD of Sample """ from keras.preprocessing import sequence from keras.datasets import imdb (X_train, y_train), (X_test, y_test) = imdb.load_data(nb_words=20000) X_train = sequence.pad_sequences(X_train, maxlen=100) X...
def load_imdb(): """ Load IMDB dataset Transform input data into an RDD of Sample """ from keras.preprocessing import sequence from keras.datasets import imdb (X_train, y_train), (X_test, y_test) = imdb.load_data(nb_words=20000) X_train = sequence.pad_sequences(X_train, maxlen=100) X...
[ "Load", "IMDB", "dataset", "Transform", "input", "data", "into", "an", "RDD", "of", "Sample" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/examples/keras/imdb_cnn_lstm.py#L27-L37
[ "def", "load_imdb", "(", ")", ":", "from", "keras", ".", "preprocessing", "import", "sequence", "from", "keras", ".", "datasets", "import", "imdb", "(", "X_train", ",", "y_train", ")", ",", "(", "X_test", ",", "y_test", ")", "=", "imdb", ".", "load_data"...
e9c19788285986ab789a2e2998f9a85d7524779f
test
build_keras_model
Define a recurrent convolutional model in Keras 1.2.2
pyspark/bigdl/examples/keras/imdb_cnn_lstm.py
def build_keras_model(): """ Define a recurrent convolutional model in Keras 1.2.2 """ from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers import LSTM from keras.layers import Convolution1D, MaxPooli...
def build_keras_model(): """ Define a recurrent convolutional model in Keras 1.2.2 """ from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers import LSTM from keras.layers import Convolution1D, MaxPooli...
[ "Define", "a", "recurrent", "convolutional", "model", "in", "Keras", "1", ".", "2", ".", "2" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/examples/keras/imdb_cnn_lstm.py#L40-L61
[ "def", "build_keras_model", "(", ")", ":", "from", "keras", ".", "models", "import", "Sequential", "from", "keras", ".", "layers", "import", "Dense", ",", "Dropout", ",", "Activation", "from", "keras", ".", "layers", "import", "Embedding", "from", "keras", "...
e9c19788285986ab789a2e2998f9a85d7524779f
test
merge
Functional merge. Only use this method if you are defining a graph model. Used to merge a list of input nodes into a single output node (NOT layers!), following some merge mode. # Arguments inputs: A list of node instances. Must be more than one node. mode: Merge mode. String, must be one of: 'sum'...
pyspark/bigdl/nn/keras/layer.py
def merge(inputs, mode="sum", concat_axis=-1, name=None): """ Functional merge. Only use this method if you are defining a graph model. Used to merge a list of input nodes into a single output node (NOT layers!), following some merge mode. # Arguments inputs: A list of node instances. Must be m...
def merge(inputs, mode="sum", concat_axis=-1, name=None): """ Functional merge. Only use this method if you are defining a graph model. Used to merge a list of input nodes into a single output node (NOT layers!), following some merge mode. # Arguments inputs: A list of node instances. Must be m...
[ "Functional", "merge", ".", "Only", "use", "this", "method", "if", "you", "are", "defining", "a", "graph", "model", ".", "Used", "to", "merge", "a", "list", "of", "input", "nodes", "into", "a", "single", "output", "node", "(", "NOT", "layers!", ")", "f...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/keras/layer.py#L337-L351
[ "def", "merge", "(", "inputs", ",", "mode", "=", "\"sum\"", ",", "concat_axis", "=", "-", "1", ",", "name", "=", "None", ")", ":", "return", "Merge", "(", "mode", "=", "mode", ",", "concat_axis", "=", "concat_axis", ",", "name", "=", "name", ")", "...
e9c19788285986ab789a2e2998f9a85d7524779f
test
InferShape.get_input_shape
Return a list of shape tuples if there are multiple inputs. Return one shape tuple otherwise.
pyspark/bigdl/nn/keras/layer.py
def get_input_shape(self): """ Return a list of shape tuples if there are multiple inputs. Return one shape tuple otherwise. """ input = callBigDlFunc(self.bigdl_type, "getInputShape", self.value) return self.__process_shape(input)
def get_input_shape(self): """ Return a list of shape tuples if there are multiple inputs. Return one shape tuple otherwise. """ input = callBigDlFunc(self.bigdl_type, "getInputShape", self.value) return self.__process_shape(input)
[ "Return", "a", "list", "of", "shape", "tuples", "if", "there", "are", "multiple", "inputs", ".", "Return", "one", "shape", "tuple", "otherwise", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/keras/layer.py#L41-L48
[ "def", "get_input_shape", "(", "self", ")", ":", "input", "=", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"getInputShape\"", ",", "self", ".", "value", ")", "return", "self", ".", "__process_shape", "(", "input", ")" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
InferShape.get_output_shape
Return a list of shape tuples if there are multiple outputs. Return one shape tuple otherwise.
pyspark/bigdl/nn/keras/layer.py
def get_output_shape(self): """ Return a list of shape tuples if there are multiple outputs. Return one shape tuple otherwise. """ output = callBigDlFunc(self.bigdl_type, "getOutputShape", self.value) return self.__process_shape(output)
def get_output_shape(self): """ Return a list of shape tuples if there are multiple outputs. Return one shape tuple otherwise. """ output = callBigDlFunc(self.bigdl_type, "getOutputShape", self.value) return self.__process_shape(output)
[ "Return", "a", "list", "of", "shape", "tuples", "if", "there", "are", "multiple", "outputs", ".", "Return", "one", "shape", "tuple", "otherwise", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/nn/keras/layer.py#L50-L57
[ "def", "get_output_shape", "(", "self", ")", ":", "output", "=", "callBigDlFunc", "(", "self", ".", "bigdl_type", ",", "\"getOutputShape\"", ",", "self", ".", "value", ")", "return", "self", ".", "__process_shape", "(", "output", ")" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
get_mnist
Get mnist dataset with features and label as ndarray. Data would be downloaded automatically if it doesn't present at the specific location. :param data_type: "train" for training data and "test" for testing data. :param location: Location to store mnist dataset. :return: (features: ndarray, label: nda...
pyspark/bigdl/models/local_lenet/local_lenet.py
def get_mnist(data_type="train", location="/tmp/mnist"): """ Get mnist dataset with features and label as ndarray. Data would be downloaded automatically if it doesn't present at the specific location. :param data_type: "train" for training data and "test" for testing data. :param location: Locatio...
def get_mnist(data_type="train", location="/tmp/mnist"): """ Get mnist dataset with features and label as ndarray. Data would be downloaded automatically if it doesn't present at the specific location. :param data_type: "train" for training data and "test" for testing data. :param location: Locatio...
[ "Get", "mnist", "dataset", "with", "features", "and", "label", "as", "ndarray", ".", "Data", "would", "be", "downloaded", "automatically", "if", "it", "doesn", "t", "present", "at", "the", "specific", "location", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/models/local_lenet/local_lenet.py#L25-L35
[ "def", "get_mnist", "(", "data_type", "=", "\"train\"", ",", "location", "=", "\"/tmp/mnist\"", ")", ":", "X", ",", "Y", "=", "mnist", ".", "read_data_sets", "(", "location", ",", "data_type", ")", "return", "X", ",", "Y", "+", "1" ]
e9c19788285986ab789a2e2998f9a85d7524779f
test
read_data_sets
Parse or download movielens 1m data if train_dir is empty. :param data_dir: The directory storing the movielens data :return: a 2D numpy array with user index and item index in each row
pyspark/bigdl/dataset/movielens.py
def read_data_sets(data_dir): """ Parse or download movielens 1m data if train_dir is empty. :param data_dir: The directory storing the movielens data :return: a 2D numpy array with user index and item index in each row """ WHOLE_DATA = 'ml-1m.zip' local_file = base.maybe_download(WHOLE_D...
def read_data_sets(data_dir): """ Parse or download movielens 1m data if train_dir is empty. :param data_dir: The directory storing the movielens data :return: a 2D numpy array with user index and item index in each row """ WHOLE_DATA = 'ml-1m.zip' local_file = base.maybe_download(WHOLE_D...
[ "Parse", "or", "download", "movielens", "1m", "data", "if", "train_dir", "is", "empty", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/dataset/movielens.py#L25-L44
[ "def", "read_data_sets", "(", "data_dir", ")", ":", "WHOLE_DATA", "=", "'ml-1m.zip'", "local_file", "=", "base", ".", "maybe_download", "(", "WHOLE_DATA", ",", "data_dir", ",", "SOURCE_URL", "+", "WHOLE_DATA", ")", "zip_ref", "=", "zipfile", ".", "ZipFile", "(...
e9c19788285986ab789a2e2998f9a85d7524779f
test
get_bigdl_classpath
Get and return the jar path for bigdl if exists.
pyspark/bigdl/util/engine.py
def get_bigdl_classpath(): """ Get and return the jar path for bigdl if exists. """ if os.getenv("BIGDL_CLASSPATH"): return os.environ["BIGDL_CLASSPATH"] jar_dir = os.path.abspath(__file__ + "/../../") jar_paths = glob.glob(os.path.join(jar_dir, "share/lib/*.jar")) if jar_paths: ...
def get_bigdl_classpath(): """ Get and return the jar path for bigdl if exists. """ if os.getenv("BIGDL_CLASSPATH"): return os.environ["BIGDL_CLASSPATH"] jar_dir = os.path.abspath(__file__ + "/../../") jar_paths = glob.glob(os.path.join(jar_dir, "share/lib/*.jar")) if jar_paths: ...
[ "Get", "and", "return", "the", "jar", "path", "for", "bigdl", "if", "exists", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/engine.py#L99-L110
[ "def", "get_bigdl_classpath", "(", ")", ":", "if", "os", ".", "getenv", "(", "\"BIGDL_CLASSPATH\"", ")", ":", "return", "os", ".", "environ", "[", "\"BIGDL_CLASSPATH\"", "]", "jar_dir", "=", "os", ".", "path", ".", "abspath", "(", "__file__", "+", "\"/../....
e9c19788285986ab789a2e2998f9a85d7524779f
test
is_spark_below_2_2
Check if spark version is below 2.2
pyspark/bigdl/util/engine.py
def is_spark_below_2_2(): """ Check if spark version is below 2.2 """ import pyspark if(hasattr(pyspark,"version")): full_version = pyspark.version.__version__ # We only need the general spark version (eg, 1.6, 2.2). parts = full_version.split(".") spark_version = par...
def is_spark_below_2_2(): """ Check if spark version is below 2.2 """ import pyspark if(hasattr(pyspark,"version")): full_version = pyspark.version.__version__ # We only need the general spark version (eg, 1.6, 2.2). parts = full_version.split(".") spark_version = par...
[ "Check", "if", "spark", "version", "is", "below", "2", ".", "2" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/engine.py#L113-L125
[ "def", "is_spark_below_2_2", "(", ")", ":", "import", "pyspark", "if", "(", "hasattr", "(", "pyspark", ",", "\"version\"", ")", ")", ":", "full_version", "=", "pyspark", ".", "version", ".", "__version__", "# We only need the general spark version (eg, 1.6, 2.2).", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
compare_version
Compare version strings. :param version1; :param version2; :return: 1 if version1 is after version2; -1 if version1 is before version2; 0 if two versions are the same.
pyspark/bigdl/util/engine.py
def compare_version(version1, version2): """ Compare version strings. :param version1; :param version2; :return: 1 if version1 is after version2; -1 if version1 is before version2; 0 if two versions are the same. """ v1Arr = version1.split(".") v2Arr = version2.split(".") len1 = len(...
def compare_version(version1, version2): """ Compare version strings. :param version1; :param version2; :return: 1 if version1 is after version2; -1 if version1 is before version2; 0 if two versions are the same. """ v1Arr = version1.split(".") v2Arr = version2.split(".") len1 = len(...
[ "Compare", "version", "strings", ".", ":", "param", "version1", ";", ":", "param", "version2", ";", ":", "return", ":", "1", "if", "version1", "is", "after", "version2", ";", "-", "1", "if", "version1", "is", "before", "version2", ";", "0", "if", "two"...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/engine.py#L128-L151
[ "def", "compare_version", "(", "version1", ",", "version2", ")", ":", "v1Arr", "=", "version1", ".", "split", "(", "\".\"", ")", "v2Arr", "=", "version2", ".", "split", "(", "\".\"", ")", "len1", "=", "len", "(", "v1Arr", ")", "len2", "=", "len", "("...
e9c19788285986ab789a2e2998f9a85d7524779f
test
convert
Convert tensorflow model to bigdl model :param input_ops: operation list used for input, should be placeholders :param output_ops: operations list used for output :return: bigdl model
pyspark/bigdl/util/tf_utils.py
def convert(input_ops, output_ops, byte_order, bigdl_type): """ Convert tensorflow model to bigdl model :param input_ops: operation list used for input, should be placeholders :param output_ops: operations list used for output :return: bigdl model """ input_names = map(lambda x: x.name.spli...
def convert(input_ops, output_ops, byte_order, bigdl_type): """ Convert tensorflow model to bigdl model :param input_ops: operation list used for input, should be placeholders :param output_ops: operations list used for output :return: bigdl model """ input_names = map(lambda x: x.name.spli...
[ "Convert", "tensorflow", "model", "to", "bigdl", "model", ":", "param", "input_ops", ":", "operation", "list", "used", "for", "input", "should", "be", "placeholders", ":", "param", "output_ops", ":", "operations", "list", "used", "for", "output", ":", "return"...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/tf_utils.py#L55-L80
[ "def", "convert", "(", "input_ops", ",", "output_ops", ",", "byte_order", ",", "bigdl_type", ")", ":", "input_names", "=", "map", "(", "lambda", "x", ":", "x", ".", "name", ".", "split", "(", "\":\"", ")", "[", "0", "]", ",", "input_ops", ")", "outpu...
e9c19788285986ab789a2e2998f9a85d7524779f
test
export_checkpoint
Export variable tensors from the checkpoint files. :param checkpoint_path: tensorflow checkpoint path :return: dictionary of tensor. The key is the variable name and the value is the numpy
pyspark/bigdl/util/tf_utils.py
def export_checkpoint(checkpoint_path): """ Export variable tensors from the checkpoint files. :param checkpoint_path: tensorflow checkpoint path :return: dictionary of tensor. The key is the variable name and the value is the numpy """ reader = tf.train.NewCheckpointReader(checkpoint_path) ...
def export_checkpoint(checkpoint_path): """ Export variable tensors from the checkpoint files. :param checkpoint_path: tensorflow checkpoint path :return: dictionary of tensor. The key is the variable name and the value is the numpy """ reader = tf.train.NewCheckpointReader(checkpoint_path) ...
[ "Export", "variable", "tensors", "from", "the", "checkpoint", "files", "." ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/tf_utils.py#L83-L100
[ "def", "export_checkpoint", "(", "checkpoint_path", ")", ":", "reader", "=", "tf", ".", "train", ".", "NewCheckpointReader", "(", "checkpoint_path", ")", "# Get tensor name list", "tensor_names", "=", "filter", "(", "lambda", "n", ":", "n", "!=", "'global_step'", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
save_variable_bigdl
Save a variable dictionary to a Java object file, so it can be read by BigDL :param tensors: tensor dictionary :param target_path: where is the Java object file store :param bigdl_type: model variable numeric type :return: nothing
pyspark/bigdl/util/tf_utils.py
def save_variable_bigdl(tensors, target_path, bigdl_type="float"): """ Save a variable dictionary to a Java object file, so it can be read by BigDL :param tensors: tensor dictionary :param target_path: where is the Java object file store :param bigdl_type: model variable numeric type :return: n...
def save_variable_bigdl(tensors, target_path, bigdl_type="float"): """ Save a variable dictionary to a Java object file, so it can be read by BigDL :param tensors: tensor dictionary :param target_path: where is the Java object file store :param bigdl_type: model variable numeric type :return: n...
[ "Save", "a", "variable", "dictionary", "to", "a", "Java", "object", "file", "so", "it", "can", "be", "read", "by", "BigDL" ]
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/tf_utils.py#L103-L121
[ "def", "save_variable_bigdl", "(", "tensors", ",", "target_path", ",", "bigdl_type", "=", "\"float\"", ")", ":", "import", "numpy", "as", "np", "jtensors", "=", "{", "}", "for", "tn", "in", "tensors", ".", "keys", "(", ")", ":", "if", "not", "isinstance"...
e9c19788285986ab789a2e2998f9a85d7524779f
test
dump_model
Dump a tensorflow model to files. The graph will be dumped to path/model.pb, and the checkpoint will be dumped to path/model.bin :param path: dump folder path :param sess: if user pass in session, we assume that the variable of the graph in the session has been inited :param graph: tensorflow g...
pyspark/bigdl/util/tf_utils.py
def dump_model(path, graph=None, sess=None, ckpt_file=None, bigdl_type="float"): """ Dump a tensorflow model to files. The graph will be dumped to path/model.pb, and the checkpoint will be dumped to path/model.bin :param path: dump folder path :param sess: if user pass in session, we assume tha...
def dump_model(path, graph=None, sess=None, ckpt_file=None, bigdl_type="float"): """ Dump a tensorflow model to files. The graph will be dumped to path/model.pb, and the checkpoint will be dumped to path/model.bin :param path: dump folder path :param sess: if user pass in session, we assume tha...
[ "Dump", "a", "tensorflow", "model", "to", "files", ".", "The", "graph", "will", "be", "dumped", "to", "path", "/", "model", ".", "pb", "and", "the", "checkpoint", "will", "be", "dumped", "to", "path", "/", "model", ".", "bin", ":", "param", "path", "...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/tf_utils.py#L124-L164
[ "def", "dump_model", "(", "path", ",", "graph", "=", "None", ",", "sess", "=", "None", ",", "ckpt_file", "=", "None", ",", "bigdl_type", "=", "\"float\"", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "raise", "Valu...
e9c19788285986ab789a2e2998f9a85d7524779f
test
merge_checkpoint
Get the variable values from the checkpoint file, and merge them to the GraphDef file Args: input_graph: the GraphDef file, doesn't contain variable values checkpoint: the checkpoint file output_node_names: A list of string, the output names output_graph: String of the location and t...
pyspark/bigdl/util/tf_utils.py
def merge_checkpoint(input_graph, checkpoint, output_node_names, output_graph, sess): """ Get the variable values from the checkpoint file, and merge them to the GraphDef file Args: input_graph: the GraphDef file, do...
def merge_checkpoint(input_graph, checkpoint, output_node_names, output_graph, sess): """ Get the variable values from the checkpoint file, and merge them to the GraphDef file Args: input_graph: the GraphDef file, do...
[ "Get", "the", "variable", "values", "from", "the", "checkpoint", "file", "and", "merge", "them", "to", "the", "GraphDef", "file", "Args", ":", "input_graph", ":", "the", "GraphDef", "file", "doesn", "t", "contain", "variable", "values", "checkpoint", ":", "t...
intel-analytics/BigDL
python
https://github.com/intel-analytics/BigDL/blob/e9c19788285986ab789a2e2998f9a85d7524779f/pyspark/bigdl/util/tf_utils.py#L167-L202
[ "def", "merge_checkpoint", "(", "input_graph", ",", "checkpoint", ",", "output_node_names", ",", "output_graph", ",", "sess", ")", ":", "restore_op_name", "=", "\"save/restore_all\"", "filename_tensor_name", "=", "\"save/Const:0\"", "input_graph_def", "=", "graph_pb2", ...
e9c19788285986ab789a2e2998f9a85d7524779f
test
DefaultAgent._call
Processes batch of utterances and returns corresponding responses batch. Each call of Agent passes incoming utterances batch through skills filter, agent skills, skills processor. Batch of dialog IDs can be provided, in other case utterances indexes in incoming batch are used as dialog IDs. ...
deeppavlov/agents/default_agent/default_agent.py
def _call(self, utterances_batch: list, utterances_ids: Optional[list]=None) -> list: """ Processes batch of utterances and returns corresponding responses batch. Each call of Agent passes incoming utterances batch through skills filter, agent skills, skills processor. Batch of dialog I...
def _call(self, utterances_batch: list, utterances_ids: Optional[list]=None) -> list: """ Processes batch of utterances and returns corresponding responses batch. Each call of Agent passes incoming utterances batch through skills filter, agent skills, skills processor. Batch of dialog I...
[ "Processes", "batch", "of", "utterances", "and", "returns", "corresponding", "responses", "batch", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/agents/default_agent/default_agent.py#L56-L95
[ "def", "_call", "(", "self", ",", "utterances_batch", ":", "list", ",", "utterances_ids", ":", "Optional", "[", "list", "]", "=", "None", ")", "->", "list", ":", "batch_size", "=", "len", "(", "utterances_batch", ")", "ids", "=", "utterances_ids", "or", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
expand_tile
Expand and tile tensor along given axis Args: units: tf tensor with dimensions [batch_size, time_steps, n_input_features] axis: axis along which expand and tile. Must be 1 or 2
deeppavlov/core/layers/keras_layers.py
def expand_tile(units, axis): """ Expand and tile tensor along given axis Args: units: tf tensor with dimensions [batch_size, time_steps, n_input_features] axis: axis along which expand and tile. Must be 1 or 2 """ assert axis in (1, 2) n_time_steps = K.int_shape(units)[1] ...
def expand_tile(units, axis): """ Expand and tile tensor along given axis Args: units: tf tensor with dimensions [batch_size, time_steps, n_input_features] axis: axis along which expand and tile. Must be 1 or 2 """ assert axis in (1, 2) n_time_steps = K.int_shape(units)[1] ...
[ "Expand", "and", "tile", "tensor", "along", "given", "axis" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/keras_layers.py#L22-L39
[ "def", "expand_tile", "(", "units", ",", "axis", ")", ":", "assert", "axis", "in", "(", "1", ",", "2", ")", "n_time_steps", "=", "K", ".", "int_shape", "(", "units", ")", "[", "1", "]", "repetitions", "=", "[", "1", ",", "1", ",", "1", ",", "1"...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
additive_self_attention
Compute additive self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <v, tanh(W_1 h_i + W_2 h_j)> v is a learnable vector of n_hidden dimensionality, W_1 and W_2 are learnable [n_hidden, n_input_features] matrices Args: units: ...
deeppavlov/core/layers/keras_layers.py
def additive_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Compute additive self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <v, tanh(W_1 h_i + W_2 h_j)> v is a learnable vector of n_hidden dimensionality...
def additive_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Compute additive self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <v, tanh(W_1 h_i + W_2 h_j)> v is a learnable vector of n_hidden dimensionality...
[ "Compute", "additive", "self", "attention", "for", "time", "series", "of", "vectors", "(", "with", "batch", "dimension", ")", "the", "formula", ":", "score", "(", "h_i", "h_j", ")", "=", "<v", "tanh", "(", "W_1", "h_i", "+", "W_2", "h_j", ")", ">", "...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/keras_layers.py#L42-L70
[ "def", "additive_self_attention", "(", "units", ",", "n_hidden", "=", "None", ",", "n_output_features", "=", "None", ",", "activation", "=", "None", ")", ":", "n_input_features", "=", "K", ".", "int_shape", "(", "units", ")", "[", "2", "]", "if", "n_hidden...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
multiplicative_self_attention
Compute multiplicative self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <W_1 h_i, W_2 h_j>, W_1 and W_2 are learnable matrices with dimensionality [n_hidden, n_input_features] Args: units: tf tensor with dimensionality [batch_size, time_steps, n_inpu...
deeppavlov/core/layers/keras_layers.py
def multiplicative_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Compute multiplicative self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <W_1 h_i, W_2 h_j>, W_1 and W_2 are learnable matrices with dimensionality [n_hid...
def multiplicative_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Compute multiplicative self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <W_1 h_i, W_2 h_j>, W_1 and W_2 are learnable matrices with dimensionality [n_hid...
[ "Compute", "multiplicative", "self", "attention", "for", "time", "series", "of", "vectors", "(", "with", "batch", "dimension", ")", "the", "formula", ":", "score", "(", "h_i", "h_j", ")", "=", "<W_1", "h_i", "W_2", "h_j", ">", "W_1", "and", "W_2", "are",...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/keras_layers.py#L73-L102
[ "def", "multiplicative_self_attention", "(", "units", ",", "n_hidden", "=", "None", ",", "n_output_features", "=", "None", ",", "activation", "=", "None", ")", ":", "n_input_features", "=", "K", ".", "int_shape", "(", "units", ")", "[", "2", "]", "if", "n_...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
precompute_future_symbols
Collecting possible continuations of length <= n for every node
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def precompute_future_symbols(trie, n, allow_spaces=False): """ Collecting possible continuations of length <= n for every node """ if n == 0: return if trie.is_terminated and trie.precompute_symbols: # символы уже предпосчитаны return for index, final in enumerate(trie.f...
def precompute_future_symbols(trie, n, allow_spaces=False): """ Collecting possible continuations of length <= n for every node """ if n == 0: return if trie.is_terminated and trie.precompute_symbols: # символы уже предпосчитаны return for index, final in enumerate(trie.f...
[ "Collecting", "possible", "continuations", "of", "length", "<", "=", "n", "for", "every", "node" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L465-L488
[ "def", "precompute_future_symbols", "(", "trie", ",", "n", ",", "allow_spaces", "=", "False", ")", ":", "if", "n", "==", "0", ":", "return", "if", "trie", ".", "is_terminated", "and", "trie", ".", "precompute_symbols", ":", "# символы уже предпосчитаны", "retu...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie.save
Сохраняет дерево для дальнейшего использования
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def save(self, outfile): """ Сохраняет дерево для дальнейшего использования """ with open(outfile, "w", encoding="utf8") as fout: attr_values = [getattr(self, attr) for attr in Trie.ATTRS] attr_values.append(any(x is not None for x in self.data)) fout....
def save(self, outfile): """ Сохраняет дерево для дальнейшего использования """ with open(outfile, "w", encoding="utf8") as fout: attr_values = [getattr(self, attr) for attr in Trie.ATTRS] attr_values.append(any(x is not None for x in self.data)) fout....
[ "Сохраняет", "дерево", "для", "дальнейшего", "использования" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L61-L82
[ "def", "save", "(", "self", ",", "outfile", ")", ":", "with", "open", "(", "outfile", ",", "\"w\"", ",", "encoding", "=", "\"utf8\"", ")", "as", "fout", ":", "attr_values", "=", "[", "getattr", "(", "self", ",", "attr", ")", "for", "attr", "in", "T...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie.make_cashed
Включает кэширование запросов к descend
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def make_cashed(self): """ Включает кэширование запросов к descend """ self._descendance_cash = [dict() for _ in self.graph] self.descend = self._descend_cashed
def make_cashed(self): """ Включает кэширование запросов к descend """ self._descendance_cash = [dict() for _ in self.graph] self.descend = self._descend_cashed
[ "Включает", "кэширование", "запросов", "к", "descend" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L84-L89
[ "def", "make_cashed", "(", "self", ")", ":", "self", ".", "_descendance_cash", "=", "[", "dict", "(", ")", "for", "_", "in", "self", ".", "graph", "]", "self", ".", "descend", "=", "self", ".", "_descend_cashed" ]
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie.add
Добавление строки s в префиксный бор
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def add(self, s): """ Добавление строки s в префиксный бор """ if self.is_terminated: raise TypeError("Impossible to add string to fitted trie") if s == "": self._set_final(self.root) return curr = self.root for i, a in enumerat...
def add(self, s): """ Добавление строки s в префиксный бор """ if self.is_terminated: raise TypeError("Impossible to add string to fitted trie") if s == "": self._set_final(self.root) return curr = self.root for i, a in enumerat...
[ "Добавление", "строки", "s", "в", "префиксный", "бор" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L96-L115
[ "def", "add", "(", "self", ",", "s", ")", ":", "if", "self", ".", "is_terminated", ":", "raise", "TypeError", "(", "\"Impossible to add string to fitted trie\"", ")", "if", "s", "==", "\"\"", ":", "self", ".", "_set_final", "(", "self", ".", "root", ")", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie.words
Возвращает итератор по словам, содержащимся в боре
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def words(self): """ Возвращает итератор по словам, содержащимся в боре """ branch, word, indexes = [self.root], [], [0] letters_with_children = [self._get_children_and_letters(self.root)] while len(branch) > 0: if self.is_final(branch[-1]): yi...
def words(self): """ Возвращает итератор по словам, содержащимся в боре """ branch, word, indexes = [self.root], [], [0] letters_with_children = [self._get_children_and_letters(self.root)] while len(branch) > 0: if self.is_final(branch[-1]): yi...
[ "Возвращает", "итератор", "по", "словам", "содержащимся", "в", "боре" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L139-L160
[ "def", "words", "(", "self", ")", ":", "branch", ",", "word", ",", "indexes", "=", "[", "self", ".", "root", "]", ",", "[", "]", ",", "[", "0", "]", "letters_with_children", "=", "[", "self", ".", "_get_children_and_letters", "(", "self", ".", "root"...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie.find_partitions
Находит все разбиения s = s_1 ... s_m на словарные слова s_1, ..., s_m для m <= max_count
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def find_partitions(self, s, max_count=1): """ Находит все разбиения s = s_1 ... s_m на словарные слова s_1, ..., s_m для m <= max_count """ curr_agenda = [(self.root, [], 0)] for i, a in enumerate(s): next_agenda = [] for curr, borders, cost in cu...
def find_partitions(self, s, max_count=1): """ Находит все разбиения s = s_1 ... s_m на словарные слова s_1, ..., s_m для m <= max_count """ curr_agenda = [(self.root, [], 0)] for i, a in enumerate(s): next_agenda = [] for curr, borders, cost in cu...
[ "Находит", "все", "разбиения", "s", "=", "s_1", "...", "s_m", "на", "словарные", "слова", "s_1", "...", "s_m", "для", "m", "<", "=", "max_count" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L175-L199
[ "def", "find_partitions", "(", "self", ",", "s", ",", "max_count", "=", "1", ")", ":", "curr_agenda", "=", "[", "(", "self", ".", "root", ",", "[", "]", ",", "0", ")", "]", "for", "i", ",", "a", "in", "enumerate", "(", "s", ")", ":", "next_agen...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie._add_empty_child
Добавление ребёнка к вершине parent по символу с кодом code
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def _add_empty_child(self, parent, code, final=False): """ Добавление ребёнка к вершине parent по символу с кодом code """ self.graph[parent][code] = self.nodes_number self.graph.append(self._make_default_node()) self.data.append(None) self.final.append(final) ...
def _add_empty_child(self, parent, code, final=False): """ Добавление ребёнка к вершине parent по символу с кодом code """ self.graph[parent][code] = self.nodes_number self.graph.append(self._make_default_node()) self.data.append(None) self.final.append(final) ...
[ "Добавление", "ребёнка", "к", "вершине", "parent", "по", "символу", "с", "кодом", "code" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L224-L233
[ "def", "_add_empty_child", "(", "self", ",", "parent", ",", "code", ",", "final", "=", "False", ")", ":", "self", ".", "graph", "[", "parent", "]", "[", "code", "]", "=", "self", ".", "nodes_number", "self", ".", "graph", ".", "append", "(", "self", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie._descend_simple
Спуск из вершины curr по строке s
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def _descend_simple(self, curr, s): """ Спуск из вершины curr по строке s """ for a in s: curr = self.graph[curr][self.alphabet_codes[a]] if curr == Trie.NO_NODE: break return curr
def _descend_simple(self, curr, s): """ Спуск из вершины curr по строке s """ for a in s: curr = self.graph[curr][self.alphabet_codes[a]] if curr == Trie.NO_NODE: break return curr
[ "Спуск", "из", "вершины", "curr", "по", "строке", "s" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L235-L243
[ "def", "_descend_simple", "(", "self", ",", "curr", ",", "s", ")", ":", "for", "a", "in", "s", ":", "curr", "=", "self", ".", "graph", "[", "curr", "]", "[", "self", ".", "alphabet_codes", "[", "a", "]", "]", "if", "curr", "==", "Trie", ".", "N...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie._descend_cashed
Спуск из вершины curr по строке s с кэшированием
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def _descend_cashed(self, curr, s): """ Спуск из вершины curr по строке s с кэшированием """ if s == "": return curr curr_cash = self._descendance_cash[curr] answer = curr_cash.get(s, None) if answer is not None: return answer # для...
def _descend_cashed(self, curr, s): """ Спуск из вершины curr по строке s с кэшированием """ if s == "": return curr curr_cash = self._descendance_cash[curr] answer = curr_cash.get(s, None) if answer is not None: return answer # для...
[ "Спуск", "из", "вершины", "curr", "по", "строке", "s", "с", "кэшированием" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L245-L263
[ "def", "_descend_cashed", "(", "self", ",", "curr", ",", "s", ")", ":", "if", "s", "==", "\"\"", ":", "return", "curr", "curr_cash", "=", "self", ".", "_descendance_cash", "[", "curr", "]", "answer", "=", "curr_cash", ".", "get", "(", "s", ",", "None...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie._get_letters
Извлекает все метки выходных рёбер вершины с номером index
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def _get_letters(self, index, return_indexes=False): """ Извлекает все метки выходных рёбер вершины с номером index """ if self.dict_storage: answer = list(self.graph[index].keys()) else: answer = [i for i, elem in enumerate(self.graph[index]) ...
def _get_letters(self, index, return_indexes=False): """ Извлекает все метки выходных рёбер вершины с номером index """ if self.dict_storage: answer = list(self.graph[index].keys()) else: answer = [i for i, elem in enumerate(self.graph[index]) ...
[ "Извлекает", "все", "метки", "выходных", "рёбер", "вершины", "с", "номером", "index" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L271-L282
[ "def", "_get_letters", "(", "self", ",", "index", ",", "return_indexes", "=", "False", ")", ":", "if", "self", ".", "dict_storage", ":", "answer", "=", "list", "(", "self", ".", "graph", "[", "index", "]", ".", "keys", "(", ")", ")", "else", ":", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
Trie._get_children
Извлекает всех потомков вершины с номером index
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def _get_children(self, index): """ Извлекает всех потомков вершины с номером index """ if self.dict_storage: return list(self.graph[index].values()) else: return [elem for elem in self.graph[index] if elem != Trie.NO_NODE]
def _get_children(self, index): """ Извлекает всех потомков вершины с номером index """ if self.dict_storage: return list(self.graph[index].values()) else: return [elem for elem in self.graph[index] if elem != Trie.NO_NODE]
[ "Извлекает", "всех", "потомков", "вершины", "с", "номером", "index" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L295-L302
[ "def", "_get_children", "(", "self", ",", "index", ")", ":", "if", "self", ".", "dict_storage", ":", "return", "list", "(", "self", ".", "graph", "[", "index", "]", ".", "values", "(", ")", ")", "else", ":", "return", "[", "elem", "for", "elem", "i...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
TrieMinimizer.generate_postorder
Обратная топологическая сортировка
deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py
def generate_postorder(self, trie): """ Обратная топологическая сортировка """ order, stack = [], [] stack.append(trie.root) colors = ['white'] * len(trie) while len(stack) > 0: index = stack[-1] color = colors[index] if color =...
def generate_postorder(self, trie): """ Обратная топологическая сортировка """ order, stack = [], [] stack.append(trie.root) colors = ['white'] * len(trie) while len(stack) > 0: index = stack[-1] color = colors[index] if color =...
[ "Обратная", "топологическая", "сортировка" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/spelling_correction/levenshtein/tabled_trie.py#L379-L400
[ "def", "generate_postorder", "(", "self", ",", "trie", ")", ":", "order", ",", "stack", "=", "[", "]", ",", "[", "]", "stack", ".", "append", "(", "trie", ".", "root", ")", "colors", "=", "[", "'white'", "]", "*", "len", "(", "trie", ")", "while"...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
run_population
Change save and load paths for obtained population, save config.json with model config, run population via current python executor (with which evolve.py already run) and on given devices (-1 means CPU, other integeres - visible for evolve.py GPUs) Args: population: list of dictionaries - configs of ...
deeppavlov/evolve.py
def run_population(population, evolution, gpus): """ Change save and load paths for obtained population, save config.json with model config, run population via current python executor (with which evolve.py already run) and on given devices (-1 means CPU, other integeres - visible for evolve.py GPUs) ...
def run_population(population, evolution, gpus): """ Change save and load paths for obtained population, save config.json with model config, run population via current python executor (with which evolve.py already run) and on given devices (-1 means CPU, other integeres - visible for evolve.py GPUs) ...
[ "Change", "save", "and", "load", "paths", "for", "obtained", "population", "save", "config", ".", "json", "with", "model", "config", "run", "population", "via", "current", "python", "executor", "(", "with", "which", "evolve", ".", "py", "already", "run", ")"...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/evolve.py#L173-L218
[ "def", "run_population", "(", "population", ",", "evolution", ",", "gpus", ")", ":", "population_size", "=", "len", "(", "population", ")", "for", "k", "in", "range", "(", "population_size", "//", "len", "(", "gpus", ")", "+", "1", ")", ":", "procs", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
dot_attention
Computes attention vector for each item in inputs: attention vector is a weighted sum of memory items. Dot product between input and memory vector is used as similarity measure. Gate mechanism is applied to attention vectors to produce output. Args: inputs: Tensor [batch_size x input_...
deeppavlov/models/squad/utils.py
def dot_attention(inputs, memory, mask, att_size, keep_prob=1.0, scope="dot_attention"): """Computes attention vector for each item in inputs: attention vector is a weighted sum of memory items. Dot product between input and memory vector is used as similarity measure. Gate mechanism is applie...
def dot_attention(inputs, memory, mask, att_size, keep_prob=1.0, scope="dot_attention"): """Computes attention vector for each item in inputs: attention vector is a weighted sum of memory items. Dot product between input and memory vector is used as similarity measure. Gate mechanism is applie...
[ "Computes", "attention", "vector", "for", "each", "item", "in", "inputs", ":", "attention", "vector", "is", "a", "weighted", "sum", "of", "memory", "items", ".", "Dot", "product", "between", "input", "and", "memory", "vector", "is", "used", "as", "similarity...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/squad/utils.py#L144-L183
[ "def", "dot_attention", "(", "inputs", ",", "memory", ",", "mask", ",", "att_size", ",", "keep_prob", "=", "1.0", ",", "scope", "=", "\"dot_attention\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ")", ":", "BS", ",", "IL", ",", "IH",...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
simple_attention
Simple attention without any conditions. Computes weighted sum of memory elements.
deeppavlov/models/squad/utils.py
def simple_attention(memory, att_size, mask, keep_prob=1.0, scope="simple_attention"): """Simple attention without any conditions. Computes weighted sum of memory elements. """ with tf.variable_scope(scope): BS, ML, MH = tf.unstack(tf.shape(memory)) memory_do = tf.nn.dropout(memory, ...
def simple_attention(memory, att_size, mask, keep_prob=1.0, scope="simple_attention"): """Simple attention without any conditions. Computes weighted sum of memory elements. """ with tf.variable_scope(scope): BS, ML, MH = tf.unstack(tf.shape(memory)) memory_do = tf.nn.dropout(memory, ...
[ "Simple", "attention", "without", "any", "conditions", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/squad/utils.py#L186-L198
[ "def", "simple_attention", "(", "memory", ",", "att_size", ",", "mask", ",", "keep_prob", "=", "1.0", ",", "scope", "=", "\"simple_attention\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ")", ":", "BS", ",", "ML", ",", "MH", "=", "tf...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
attention
Computes weighted sum of inputs conditioned on state
deeppavlov/models/squad/utils.py
def attention(inputs, state, att_size, mask, scope="attention"): """Computes weighted sum of inputs conditioned on state""" with tf.variable_scope(scope): u = tf.concat([tf.tile(tf.expand_dims(state, axis=1), [1, tf.shape(inputs)[1], 1]), inputs], axis=2) logits = tf.layers.dense(tf.layers.dense...
def attention(inputs, state, att_size, mask, scope="attention"): """Computes weighted sum of inputs conditioned on state""" with tf.variable_scope(scope): u = tf.concat([tf.tile(tf.expand_dims(state, axis=1), [1, tf.shape(inputs)[1], 1]), inputs], axis=2) logits = tf.layers.dense(tf.layers.dense...
[ "Computes", "weighted", "sum", "of", "inputs", "conditioned", "on", "state" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/squad/utils.py#L201-L209
[ "def", "attention", "(", "inputs", ",", "state", ",", "att_size", ",", "mask", ",", "scope", "=", "\"attention\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ")", ":", "u", "=", "tf", ".", "concat", "(", "[", "tf", ".", "tile", "(...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
compute_bleu
Computes BLEU score of translated segments against one or more references. Args: reference_corpus: list of lists of references for each translation. Each reference should be tokenized into a list of tokens. translation_corpus: list of translations to score. Each translation should be tokenize...
deeppavlov/metrics/google_bleu.py
def compute_bleu(reference_corpus, translation_corpus, max_order=4, smooth=False): """Computes BLEU score of translated segments against one or more references. Args: reference_corpus: list of lists of references for each translation. Each reference should be tokenized into a list of t...
def compute_bleu(reference_corpus, translation_corpus, max_order=4, smooth=False): """Computes BLEU score of translated segments against one or more references. Args: reference_corpus: list of lists of references for each translation. Each reference should be tokenized into a list of t...
[ "Computes", "BLEU", "score", "of", "translated", "segments", "against", "one", "or", "more", "references", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/google_bleu.py#L48-L112
[ "def", "compute_bleu", "(", "reference_corpus", ",", "translation_corpus", ",", "max_order", "=", "4", ",", "smooth", "=", "False", ")", ":", "matches_by_order", "=", "[", "0", "]", "*", "max_order", "possible_matches_by_order", "=", "[", "0", "]", "*", "max...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
DialogLogger._get_log_file
Returns opened file object for writing dialog logs. Returns: log_file: opened Python file object.
deeppavlov/core/agent/dialog_logger.py
def _get_log_file(self): """Returns opened file object for writing dialog logs. Returns: log_file: opened Python file object. """ log_dir: Path = Path(self.config['log_path']).expanduser().resolve() / self.agent_name log_dir.mkdir(parents=True, exist_ok=True) ...
def _get_log_file(self): """Returns opened file object for writing dialog logs. Returns: log_file: opened Python file object. """ log_dir: Path = Path(self.config['log_path']).expanduser().resolve() / self.agent_name log_dir.mkdir(parents=True, exist_ok=True) ...
[ "Returns", "opened", "file", "object", "for", "writing", "dialog", "logs", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/dialog_logger.py#L66-L76
[ "def", "_get_log_file", "(", "self", ")", ":", "log_dir", ":", "Path", "=", "Path", "(", "self", ".", "config", "[", "'log_path'", "]", ")", ".", "expanduser", "(", ")", ".", "resolve", "(", ")", "/", "self", ".", "agent_name", "log_dir", ".", "mkdir...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
DialogLogger._log
Logs single dialog utterance to current dialog log file. Args: utterance: Dialog utterance. direction: 'in' or 'out' utterance direction. dialog_id: Dialog ID.
deeppavlov/core/agent/dialog_logger.py
def _log(self, utterance: Any, direction: str, dialog_id: Optional[Hashable]=None): """Logs single dialog utterance to current dialog log file. Args: utterance: Dialog utterance. direction: 'in' or 'out' utterance direction. dialog_id: Dialog ID. """ ...
def _log(self, utterance: Any, direction: str, dialog_id: Optional[Hashable]=None): """Logs single dialog utterance to current dialog log file. Args: utterance: Dialog utterance. direction: 'in' or 'out' utterance direction. dialog_id: Dialog ID. """ ...
[ "Logs", "single", "dialog", "utterance", "to", "current", "dialog", "log", "file", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/dialog_logger.py#L78-L110
[ "def", "_log", "(", "self", ",", "utterance", ":", "Any", ",", "direction", ":", "str", ",", "dialog_id", ":", "Optional", "[", "Hashable", "]", "=", "None", ")", ":", "if", "isinstance", "(", "utterance", ",", "str", ")", ":", "pass", "elif", "isins...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
DialogLogger.log_in
Wraps _log method for all input utterances. Args: utterance: Dialog utterance. dialog_id: Dialog ID.
deeppavlov/core/agent/dialog_logger.py
def log_in(self, utterance: Any, dialog_id: Optional[Hashable] = None) -> None: """Wraps _log method for all input utterances. Args: utterance: Dialog utterance. dialog_id: Dialog ID. """ if self.enabled: self._log(utterance, 'in', dialog_id)
def log_in(self, utterance: Any, dialog_id: Optional[Hashable] = None) -> None: """Wraps _log method for all input utterances. Args: utterance: Dialog utterance. dialog_id: Dialog ID. """ if self.enabled: self._log(utterance, 'in', dialog_id)
[ "Wraps", "_log", "method", "for", "all", "input", "utterances", ".", "Args", ":", "utterance", ":", "Dialog", "utterance", ".", "dialog_id", ":", "Dialog", "ID", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/agent/dialog_logger.py#L112-L119
[ "def", "log_in", "(", "self", ",", "utterance", ":", "Any", ",", "dialog_id", ":", "Optional", "[", "Hashable", "]", "=", "None", ")", "->", "None", ":", "if", "self", ".", "enabled", ":", "self", ".", "_log", "(", "utterance", ",", "'in'", ",", "d...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
summary_gradient_updates
get summary ops for the magnitude of gradient updates
deeppavlov/models/elmo/train_utils.py
def summary_gradient_updates(grads, opt, lr): """get summary ops for the magnitude of gradient updates""" # strategy: # make a dict of variable name -> [variable, grad, adagrad slot] vars_grads = {} for v in tf.trainable_variables(): vars_grads[v.name] = [v, None, None] for g, v in grad...
def summary_gradient_updates(grads, opt, lr): """get summary ops for the magnitude of gradient updates""" # strategy: # make a dict of variable name -> [variable, grad, adagrad slot] vars_grads = {} for v in tf.trainable_variables(): vars_grads[v.name] = [v, None, None] for g, v in grad...
[ "get", "summary", "ops", "for", "the", "magnitude", "of", "gradient", "updates" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/elmo/train_utils.py#L84-L117
[ "def", "summary_gradient_updates", "(", "grads", ",", "opt", ",", "lr", ")", ":", "# strategy:", "# make a dict of variable name -> [variable, grad, adagrad slot]", "vars_grads", "=", "{", "}", "for", "v", "in", "tf", ".", "trainable_variables", "(", ")", ":", "vars...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
_deduplicate_indexed_slices
Sums `values` associated with any non-unique `indices`. Args: values: A `Tensor` with rank >= 1. indices: A one-dimensional integer `Tensor`, indexing into the first dimension of `values` (as in an IndexedSlices object). Returns: A tuple of (`summed_values`, `unique_indices`) where `uniq...
deeppavlov/models/elmo/train_utils.py
def _deduplicate_indexed_slices(values, indices): """Sums `values` associated with any non-unique `indices`. Args: values: A `Tensor` with rank >= 1. indices: A one-dimensional integer `Tensor`, indexing into the first dimension of `values` (as in an IndexedSlices object). Returns: A...
def _deduplicate_indexed_slices(values, indices): """Sums `values` associated with any non-unique `indices`. Args: values: A `Tensor` with rank >= 1. indices: A one-dimensional integer `Tensor`, indexing into the first dimension of `values` (as in an IndexedSlices object). Returns: A...
[ "Sums", "values", "associated", "with", "any", "non", "-", "unique", "indices", ".", "Args", ":", "values", ":", "A", "Tensor", "with", "rank", ">", "=", "1", ".", "indices", ":", "A", "one", "-", "dimensional", "integer", "Tensor", "indexing", "into", ...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/elmo/train_utils.py#L120-L135
[ "def", "_deduplicate_indexed_slices", "(", "values", ",", "indices", ")", ":", "unique_indices", ",", "new_index_positions", "=", "tf", ".", "unique", "(", "indices", ")", "summed_values", "=", "tf", ".", "unsorted_segment_sum", "(", "values", ",", "new_index_posi...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
dump_weights
Dump the trained weights from a model to a HDF5 file.
deeppavlov/models/elmo/train_utils.py
def dump_weights(tf_save_dir, outfile, options): """ Dump the trained weights from a model to a HDF5 file. """ def _get_outname(tf_name): outname = re.sub(':0$', '', tf_name) outname = outname.lstrip('lm/') outname = re.sub('/rnn/', '/RNN/', outname) outname = re.sub('/m...
def dump_weights(tf_save_dir, outfile, options): """ Dump the trained weights from a model to a HDF5 file. """ def _get_outname(tf_name): outname = re.sub(':0$', '', tf_name) outname = outname.lstrip('lm/') outname = re.sub('/rnn/', '/RNN/', outname) outname = re.sub('/m...
[ "Dump", "the", "trained", "weights", "from", "a", "model", "to", "a", "HDF5", "file", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/elmo/train_utils.py#L202-L244
[ "def", "dump_weights", "(", "tf_save_dir", ",", "outfile", ",", "options", ")", ":", "def", "_get_outname", "(", "tf_name", ")", ":", "outname", "=", "re", ".", "sub", "(", "':0$'", ",", "''", ",", "tf_name", ")", "outname", "=", "outname", ".", "lstri...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
read_data_by_config
Read data by dataset_reader from specified config.
deeppavlov/core/commands/train.py
def read_data_by_config(config: dict): """Read data by dataset_reader from specified config.""" dataset_config = config.get('dataset', None) if dataset_config: config.pop('dataset') ds_type = dataset_config['type'] if ds_type == 'classification': reader = {'class_name': ...
def read_data_by_config(config: dict): """Read data by dataset_reader from specified config.""" dataset_config = config.get('dataset', None) if dataset_config: config.pop('dataset') ds_type = dataset_config['type'] if ds_type == 'classification': reader = {'class_name': ...
[ "Read", "data", "by", "dataset_reader", "from", "specified", "config", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/train.py#L31-L58
[ "def", "read_data_by_config", "(", "config", ":", "dict", ")", ":", "dataset_config", "=", "config", ".", "get", "(", "'dataset'", ",", "None", ")", "if", "dataset_config", ":", "config", ".", "pop", "(", "'dataset'", ")", "ds_type", "=", "dataset_config", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
get_iterator_from_config
Create iterator (from config) for specified data.
deeppavlov/core/commands/train.py
def get_iterator_from_config(config: dict, data: dict): """Create iterator (from config) for specified data.""" iterator_config = config['dataset_iterator'] iterator: Union[DataLearningIterator, DataFittingIterator] = from_params(iterator_config, ...
def get_iterator_from_config(config: dict, data: dict): """Create iterator (from config) for specified data.""" iterator_config = config['dataset_iterator'] iterator: Union[DataLearningIterator, DataFittingIterator] = from_params(iterator_config, ...
[ "Create", "iterator", "(", "from", "config", ")", "for", "specified", "data", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/train.py#L61-L66
[ "def", "get_iterator_from_config", "(", "config", ":", "dict", ",", "data", ":", "dict", ")", ":", "iterator_config", "=", "config", "[", "'dataset_iterator'", "]", "iterator", ":", "Union", "[", "DataLearningIterator", ",", "DataFittingIterator", "]", "=", "fro...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
train_evaluate_model_from_config
Make training and evaluation of the model described in corresponding configuration file.
deeppavlov/core/commands/train.py
def train_evaluate_model_from_config(config: Union[str, Path, dict], iterator: Union[DataLearningIterator, DataFittingIterator] = None, *, to_train: bool = True, evaluation_targets: Optional[Iterable[str]] = N...
def train_evaluate_model_from_config(config: Union[str, Path, dict], iterator: Union[DataLearningIterator, DataFittingIterator] = None, *, to_train: bool = True, evaluation_targets: Optional[Iterable[str]] = N...
[ "Make", "training", "and", "evaluation", "of", "the", "model", "described", "in", "corresponding", "configuration", "file", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/commands/train.py#L69-L142
[ "def", "train_evaluate_model_from_config", "(", "config", ":", "Union", "[", "str", ",", "Path", ",", "dict", "]", ",", "iterator", ":", "Union", "[", "DataLearningIterator", ",", "DataFittingIterator", "]", "=", "None", ",", "*", ",", "to_train", ":", "bool...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
interact_alice
Exchange messages between basic pipelines and the Yandex.Dialogs service. If the pipeline returns multiple values, only the first one is forwarded to Yandex.
deeppavlov/utils/alice/alice.py
def interact_alice(agent: Agent): """ Exchange messages between basic pipelines and the Yandex.Dialogs service. If the pipeline returns multiple values, only the first one is forwarded to Yandex. """ data = request.get_json() text = data['request'].get('command', '').strip() payload = data['...
def interact_alice(agent: Agent): """ Exchange messages between basic pipelines and the Yandex.Dialogs service. If the pipeline returns multiple values, only the first one is forwarded to Yandex. """ data = request.get_json() text = data['request'].get('command', '').strip() payload = data['...
[ "Exchange", "messages", "between", "basic", "pipelines", "and", "the", "Yandex", ".", "Dialogs", "service", ".", "If", "the", "pipeline", "returns", "multiple", "values", "only", "the", "first", "one", "is", "forwarded", "to", "Yandex", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/utils/alice/alice.py#L45-L81
[ "def", "interact_alice", "(", "agent", ":", "Agent", ")", ":", "data", "=", "request", ".", "get_json", "(", ")", "text", "=", "data", "[", "'request'", "]", ".", "get", "(", "'command'", ",", "''", ")", ".", "strip", "(", ")", "payload", "=", "dat...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
labels2onehot
Convert labels to one-hot vectors for multi-class multi-label classification Args: labels: list of samples where each sample is a class or a list of classes which sample belongs with classes: array of classes' names Returns: 2d array with one-hot representation of given samples
deeppavlov/models/classifiers/utils.py
def labels2onehot(labels: [List[str], List[List[str]], np.ndarray], classes: [list, np.ndarray]) -> np.ndarray: """ Convert labels to one-hot vectors for multi-class multi-label classification Args: labels: list of samples where each sample is a class or a list of classes which sample belongs with...
def labels2onehot(labels: [List[str], List[List[str]], np.ndarray], classes: [list, np.ndarray]) -> np.ndarray: """ Convert labels to one-hot vectors for multi-class multi-label classification Args: labels: list of samples where each sample is a class or a list of classes which sample belongs with...
[ "Convert", "labels", "to", "one", "-", "hot", "vectors", "for", "multi", "-", "class", "multi", "-", "label", "classification" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/classifiers/utils.py#L24-L49
[ "def", "labels2onehot", "(", "labels", ":", "[", "List", "[", "str", "]", ",", "List", "[", "List", "[", "str", "]", "]", ",", "np", ".", "ndarray", "]", ",", "classes", ":", "[", "list", ",", "np", ".", "ndarray", "]", ")", "->", "np", ".", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
proba2labels
Convert vectors of probabilities to labels using confident threshold (if probability to belong with the class is bigger than confident_threshold, sample belongs with the class; if no probabilities bigger than confident threshold, sample belongs with the class with the biggest probability) Args: pro...
deeppavlov/models/classifiers/utils.py
def proba2labels(proba: [list, np.ndarray], confident_threshold: float, classes: [list, np.ndarray]) -> List[List]: """ Convert vectors of probabilities to labels using confident threshold (if probability to belong with the class is bigger than confident_threshold, sample belongs with the class; if no ...
def proba2labels(proba: [list, np.ndarray], confident_threshold: float, classes: [list, np.ndarray]) -> List[List]: """ Convert vectors of probabilities to labels using confident threshold (if probability to belong with the class is bigger than confident_threshold, sample belongs with the class; if no ...
[ "Convert", "vectors", "of", "probabilities", "to", "labels", "using", "confident", "threshold", "(", "if", "probability", "to", "belong", "with", "the", "class", "is", "bigger", "than", "confident_threshold", "sample", "belongs", "with", "the", "class", ";", "if...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/classifiers/utils.py#L52-L74
[ "def", "proba2labels", "(", "proba", ":", "[", "list", ",", "np", ".", "ndarray", "]", ",", "confident_threshold", ":", "float", ",", "classes", ":", "[", "list", ",", "np", ".", "ndarray", "]", ")", "->", "List", "[", "List", "]", ":", "y", "=", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
proba2onehot
Convert vectors of probabilities to one-hot representations using confident threshold Args: proba: samples where each sample is a vector of probabilities to belong with given classes confident_threshold: boundary of probability to belong with a class classes: array of classes' names Re...
deeppavlov/models/classifiers/utils.py
def proba2onehot(proba: [list, np.ndarray], confident_threshold: float, classes: [list, np.ndarray]) -> np.ndarray: """ Convert vectors of probabilities to one-hot representations using confident threshold Args: proba: samples where each sample is a vector of probabilities to belong with given cla...
def proba2onehot(proba: [list, np.ndarray], confident_threshold: float, classes: [list, np.ndarray]) -> np.ndarray: """ Convert vectors of probabilities to one-hot representations using confident threshold Args: proba: samples where each sample is a vector of probabilities to belong with given cla...
[ "Convert", "vectors", "of", "probabilities", "to", "one", "-", "hot", "representations", "using", "confident", "threshold" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/classifiers/utils.py#L77-L89
[ "def", "proba2onehot", "(", "proba", ":", "[", "list", ",", "np", ".", "ndarray", "]", ",", "confident_threshold", ":", "float", ",", "classes", ":", "[", "list", ",", "np", ".", "ndarray", "]", ")", "->", "np", ".", "ndarray", ":", "return", "labels...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
KerasModel._config_session
Configure session for particular device Returns: tensorflow.Session
deeppavlov/core/models/keras_model.py
def _config_session(): """ Configure session for particular device Returns: tensorflow.Session """ config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.visible_device_list = '0' return tf.Session(config=config)
def _config_session(): """ Configure session for particular device Returns: tensorflow.Session """ config = tf.ConfigProto() config.gpu_options.allow_growth = True config.gpu_options.visible_device_list = '0' return tf.Session(config=config)
[ "Configure", "session", "for", "particular", "device" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L61-L71
[ "def", "_config_session", "(", ")", ":", "config", "=", "tf", ".", "ConfigProto", "(", ")", "config", ".", "gpu_options", ".", "allow_growth", "=", "True", "config", ".", "gpu_options", ".", "visible_device_list", "=", "'0'", "return", "tf", ".", "Session", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
KerasModel.process_event
Process event after epoch Args: event_name: whether event is send after epoch or batch. Set of values: ``"after_epoch", "after_batch"`` data: event data (dictionary) Returns: None
deeppavlov/core/models/keras_model.py
def process_event(self, event_name: str, data: dict) -> None: """ Process event after epoch Args: event_name: whether event is send after epoch or batch. Set of values: ``"after_epoch", "after_batch"`` data: event data (dictionary) Returns: ...
def process_event(self, event_name: str, data: dict) -> None: """ Process event after epoch Args: event_name: whether event is send after epoch or batch. Set of values: ``"after_epoch", "after_batch"`` data: event data (dictionary) Returns: ...
[ "Process", "event", "after", "epoch", "Args", ":", "event_name", ":", "whether", "event", "is", "send", "after", "epoch", "or", "batch", ".", "Set", "of", "values", ":", "after_epoch", "after_batch", "data", ":", "event", "data", "(", "dictionary", ")" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L81-L96
[ "def", "process_event", "(", "self", ",", "event_name", ":", "str", ",", "data", ":", "dict", ")", "->", "None", ":", "if", "event_name", "==", "\"after_epoch\"", ":", "self", ".", "epochs_done", "=", "data", "[", "\"epochs_done\"", "]", "self", ".", "ba...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
KerasWrapper.load
Checks existence of the model file, loads the model if the file exists
deeppavlov/core/models/keras_model.py
def load(self) -> None: """Checks existence of the model file, loads the model if the file exists""" # Checks presence of the model files if self.load_path.exists(): path = str(self.load_path.resolve()) log.info('[loading model from {}]'.format(path)) self._n...
def load(self) -> None: """Checks existence of the model file, loads the model if the file exists""" # Checks presence of the model files if self.load_path.exists(): path = str(self.load_path.resolve()) log.info('[loading model from {}]'.format(path)) self._n...
[ "Checks", "existence", "of", "the", "model", "file", "loads", "the", "model", "if", "the", "file", "exists" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L140-L147
[ "def", "load", "(", "self", ")", "->", "None", ":", "# Checks presence of the model files", "if", "self", ".", "load_path", ".", "exists", "(", ")", ":", "path", "=", "str", "(", "self", ".", "load_path", ".", "resolve", "(", ")", ")", "log", ".", "inf...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
KerasWrapper.save
Saves model to the save_path, provided in config. The directory is already created by super().__init__, which is called in __init__ of this class
deeppavlov/core/models/keras_model.py
def save(self) -> None: """Saves model to the save_path, provided in config. The directory is already created by super().__init__, which is called in __init__ of this class""" path = str(self.save_path.absolute()) log.info('[saving model to {}]'.format(path)) self._net.save(path)
def save(self) -> None: """Saves model to the save_path, provided in config. The directory is already created by super().__init__, which is called in __init__ of this class""" path = str(self.save_path.absolute()) log.info('[saving model to {}]'.format(path)) self._net.save(path)
[ "Saves", "model", "to", "the", "save_path", "provided", "in", "config", ".", "The", "directory", "is", "already", "created", "by", "super", "()", ".", "__init__", "which", "is", "called", "in", "__init__", "of", "this", "class" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L149-L154
[ "def", "save", "(", "self", ")", "->", "None", ":", "path", "=", "str", "(", "self", ".", "save_path", ".", "absolute", "(", ")", ")", "log", ".", "info", "(", "'[saving model to {}]'", ".", "format", "(", "path", ")", ")", "self", ".", "_net", "."...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
KerasWrapper.train_on_batch
Trains the model on a single batch. Args: *args: the list of network inputs. Last element of `args` is the batch of targets, all previous elements are training data batches
deeppavlov/core/models/keras_model.py
def train_on_batch(self, *args) -> None: """Trains the model on a single batch. Args: *args: the list of network inputs. Last element of `args` is the batch of targets, all previous elements are training data batches """ *data, labels = args s...
def train_on_batch(self, *args) -> None: """Trains the model on a single batch. Args: *args: the list of network inputs. Last element of `args` is the batch of targets, all previous elements are training data batches """ *data, labels = args s...
[ "Trains", "the", "model", "on", "a", "single", "batch", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L156-L165
[ "def", "train_on_batch", "(", "self", ",", "*", "args", ")", "->", "None", ":", "*", "data", ",", "labels", "=", "args", "self", ".", "_net", ".", "train_on_batch", "(", "data", ",", "labels", ")" ]
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
LRScheduledKerasModel.get_momentum_variable
Extract values of momentum variables from optimizer Returns: optimizer's `rho` or `beta_1`
deeppavlov/core/models/keras_model.py
def get_momentum_variable(self): """ Extract values of momentum variables from optimizer Returns: optimizer's `rho` or `beta_1` """ optimizer = self.get_optimizer() if hasattr(optimizer, 'rho'): return optimizer.rho elif hasattr(optimizer,...
def get_momentum_variable(self): """ Extract values of momentum variables from optimizer Returns: optimizer's `rho` or `beta_1` """ optimizer = self.get_optimizer() if hasattr(optimizer, 'rho'): return optimizer.rho elif hasattr(optimizer,...
[ "Extract", "values", "of", "momentum", "variables", "from", "optimizer" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L238-L250
[ "def", "get_momentum_variable", "(", "self", ")", ":", "optimizer", "=", "self", ".", "get_optimizer", "(", ")", "if", "hasattr", "(", "optimizer", ",", "'rho'", ")", ":", "return", "optimizer", ".", "rho", "elif", "hasattr", "(", "optimizer", ",", "'beta_...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
LRScheduledKerasModel._update_graph_variables
Update graph variables setting giving `learning_rate` and `momentum` Args: learning_rate: learning rate value to be set in graph (set if not None) momentum: momentum value to be set in graph (set if not None) Returns: None
deeppavlov/core/models/keras_model.py
def _update_graph_variables(self, learning_rate: float = None, momentum: float = None): """ Update graph variables setting giving `learning_rate` and `momentum` Args: learning_rate: learning rate value to be set in graph (set if not None) momentum: momentum value to be s...
def _update_graph_variables(self, learning_rate: float = None, momentum: float = None): """ Update graph variables setting giving `learning_rate` and `momentum` Args: learning_rate: learning rate value to be set in graph (set if not None) momentum: momentum value to be s...
[ "Update", "graph", "variables", "setting", "giving", "learning_rate", "and", "momentum" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L253-L268
[ "def", "_update_graph_variables", "(", "self", ",", "learning_rate", ":", "float", "=", "None", ",", "momentum", ":", "float", "=", "None", ")", ":", "if", "learning_rate", "is", "not", "None", ":", "K", ".", "set_value", "(", "self", ".", "get_learning_ra...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
LRScheduledKerasModel.process_event
Process event after epoch Args: event_name: whether event is send after epoch or batch. Set of values: ``"after_epoch", "after_batch"`` data: event data (dictionary) Returns: None
deeppavlov/core/models/keras_model.py
def process_event(self, event_name: str, data: dict): """ Process event after epoch Args: event_name: whether event is send after epoch or batch. Set of values: ``"after_epoch", "after_batch"`` data: event data (dictionary) Returns: ...
def process_event(self, event_name: str, data: dict): """ Process event after epoch Args: event_name: whether event is send after epoch or batch. Set of values: ``"after_epoch", "after_batch"`` data: event data (dictionary) Returns: ...
[ "Process", "event", "after", "epoch", "Args", ":", "event_name", ":", "whether", "event", "is", "send", "after", "epoch", "or", "batch", ".", "Set", "of", "values", ":", "after_epoch", "after_batch", "data", ":", "event", "data", "(", "dictionary", ")" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/models/keras_model.py#L271-L294
[ "def", "process_event", "(", "self", ",", "event_name", ":", "str", ",", "data", ":", "dict", ")", ":", "if", "(", "isinstance", "(", "self", ".", "opt", ".", "get", "(", "\"learning_rate\"", ",", "None", ")", ",", "float", ")", "and", "isinstance", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
round_f1
Calculates F1 (binary) measure. Args: y_true: list of true values y_predicted: list of predicted values Returns: F1 score
deeppavlov/metrics/fmeasure.py
def round_f1(y_true, y_predicted): """ Calculates F1 (binary) measure. Args: y_true: list of true values y_predicted: list of predicted values Returns: F1 score """ try: predictions = [np.round(x) for x in y_predicted] except TypeError: predictions =...
def round_f1(y_true, y_predicted): """ Calculates F1 (binary) measure. Args: y_true: list of true values y_predicted: list of predicted values Returns: F1 score """ try: predictions = [np.round(x) for x in y_predicted] except TypeError: predictions =...
[ "Calculates", "F1", "(", "binary", ")", "measure", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/fmeasure.py#L40-L56
[ "def", "round_f1", "(", "y_true", ",", "y_predicted", ")", ":", "try", ":", "predictions", "=", "[", "np", ".", "round", "(", "x", ")", "for", "x", "in", "y_predicted", "]", "except", "TypeError", ":", "predictions", "=", "y_predicted", "return", "f1_sco...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
round_f1_macro
Calculates F1 macro measure. Args: y_true: list of true values y_predicted: list of predicted values Returns: F1 score
deeppavlov/metrics/fmeasure.py
def round_f1_macro(y_true, y_predicted): """ Calculates F1 macro measure. Args: y_true: list of true values y_predicted: list of predicted values Returns: F1 score """ try: predictions = [np.round(x) for x in y_predicted] except TypeError: prediction...
def round_f1_macro(y_true, y_predicted): """ Calculates F1 macro measure. Args: y_true: list of true values y_predicted: list of predicted values Returns: F1 score """ try: predictions = [np.round(x) for x in y_predicted] except TypeError: prediction...
[ "Calculates", "F1", "macro", "measure", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/metrics/fmeasure.py#L60-L76
[ "def", "round_f1_macro", "(", "y_true", ",", "y_predicted", ")", ":", "try", ":", "predictions", "=", "[", "np", ".", "round", "(", "x", ")", "for", "x", "in", "y_predicted", "]", "except", "TypeError", ":", "predictions", "=", "y_predicted", "return", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
process_word
Converts word to a tuple of symbols, optionally converts it to lowercase and adds capitalization label. Args: word: input word to_lower: whether to lowercase append_case: whether to add case mark ('<FIRST_UPPER>' for first capital and '<ALL_UPPER>' for all caps) Returns...
deeppavlov/models/preprocessors/capitalization.py
def process_word(word: str, to_lower: bool = False, append_case: Optional[str] = None) -> Tuple[str]: """Converts word to a tuple of symbols, optionally converts it to lowercase and adds capitalization label. Args: word: input word to_lower: whether to lowercase app...
def process_word(word: str, to_lower: bool = False, append_case: Optional[str] = None) -> Tuple[str]: """Converts word to a tuple of symbols, optionally converts it to lowercase and adds capitalization label. Args: word: input word to_lower: whether to lowercase app...
[ "Converts", "word", "to", "a", "tuple", "of", "symbols", "optionally", "converts", "it", "to", "lowercase", "and", "adds", "capitalization", "label", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/models/preprocessors/capitalization.py#L75-L108
[ "def", "process_word", "(", "word", ":", "str", ",", "to_lower", ":", "bool", "=", "False", ",", "append_case", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Tuple", "[", "str", "]", ":", "if", "all", "(", "x", ".", "isupper", "(", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
stacked_cnn
Number of convolutional layers stacked on top of each other Args: units: a tensorflow tensor with dimensionality [None, n_tokens, n_features] n_hidden_list: list with number of hidden units at the ouput of each layer filter_width: width of the kernel in tokens use_batch_norm: whethe...
deeppavlov/core/layers/tf_layers.py
def stacked_cnn(units: tf.Tensor, n_hidden_list: List, filter_width=3, use_batch_norm=False, use_dilation=False, training_ph=None, add_l2_losses=False): """ Number of convolutional layers stacked on top of each other ...
def stacked_cnn(units: tf.Tensor, n_hidden_list: List, filter_width=3, use_batch_norm=False, use_dilation=False, training_ph=None, add_l2_losses=False): """ Number of convolutional layers stacked on top of each other ...
[ "Number", "of", "convolutional", "layers", "stacked", "on", "top", "of", "each", "other" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L30-L71
[ "def", "stacked_cnn", "(", "units", ":", "tf", ".", "Tensor", ",", "n_hidden_list", ":", "List", ",", "filter_width", "=", "3", ",", "use_batch_norm", "=", "False", ",", "use_dilation", "=", "False", ",", "training_ph", "=", "None", ",", "add_l2_losses", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
dense_convolutional_network
Densely connected convolutional layers. Based on the paper: [Gao 17] https://arxiv.org/abs/1608.06993 Args: units: a tensorflow tensor with dimensionality [None, n_tokens, n_features] n_hidden_list: list with number of hidden units at the ouput of each layer filter_w...
deeppavlov/core/layers/tf_layers.py
def dense_convolutional_network(units: tf.Tensor, n_hidden_list: List, filter_width=3, use_dilation=False, use_batch_norm=False, training_ph=None): """ Dens...
def dense_convolutional_network(units: tf.Tensor, n_hidden_list: List, filter_width=3, use_dilation=False, use_batch_norm=False, training_ph=None): """ Dens...
[ "Densely", "connected", "convolutional", "layers", ".", "Based", "on", "the", "paper", ":", "[", "Gao", "17", "]", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1608", ".", "06993" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L74-L113
[ "def", "dense_convolutional_network", "(", "units", ":", "tf", ".", "Tensor", ",", "n_hidden_list", ":", "List", ",", "filter_width", "=", "3", ",", "use_dilation", "=", "False", ",", "use_batch_norm", "=", "False", ",", "training_ph", "=", "None", ")", ":",...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
bi_rnn
Bi directional recurrent neural network. GRU or LSTM Args: units: a tensorflow tensor with dimensionality [None, n_tokens, n_features] n_hidden: list with number of hidden units at the ouput of each layer seq_lengths: length of sequences for different length sequences in bat...
deeppavlov/core/layers/tf_layers.py
def bi_rnn(units: tf.Tensor, n_hidden: List, cell_type='gru', seq_lengths=None, trainable_initial_states=False, use_peepholes=False, name='Bi-'): """ Bi directional recurrent neural network. GRU or LSTM Args: units: a tensorflow ...
def bi_rnn(units: tf.Tensor, n_hidden: List, cell_type='gru', seq_lengths=None, trainable_initial_states=False, use_peepholes=False, name='Bi-'): """ Bi directional recurrent neural network. GRU or LSTM Args: units: a tensorflow ...
[ "Bi", "directional", "recurrent", "neural", "network", ".", "GRU", "or", "LSTM" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L116-L181
[ "def", "bi_rnn", "(", "units", ":", "tf", ".", "Tensor", ",", "n_hidden", ":", "List", ",", "cell_type", "=", "'gru'", ",", "seq_lengths", "=", "None", ",", "trainable_initial_states", "=", "False", ",", "use_peepholes", "=", "False", ",", "name", "=", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
stacked_bi_rnn
Stackted recurrent neural networks GRU or LSTM Args: units: a tensorflow tensor with dimensionality [None, n_tokens, n_features] n_hidden_list: list with number of hidden units at the ouput of each layer seq_lengths: length of sequences for different length sequences in batc...
deeppavlov/core/layers/tf_layers.py
def stacked_bi_rnn(units: tf.Tensor, n_hidden_list: List, cell_type='gru', seq_lengths=None, use_peepholes=False, name='RNN_layer'): """ Stackted recurrent neural networks GRU or LSTM Args: units: a t...
def stacked_bi_rnn(units: tf.Tensor, n_hidden_list: List, cell_type='gru', seq_lengths=None, use_peepholes=False, name='RNN_layer'): """ Stackted recurrent neural networks GRU or LSTM Args: units: a t...
[ "Stackted", "recurrent", "neural", "networks", "GRU", "or", "LSTM" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L184-L234
[ "def", "stacked_bi_rnn", "(", "units", ":", "tf", ".", "Tensor", ",", "n_hidden_list", ":", "List", ",", "cell_type", "=", "'gru'", ",", "seq_lengths", "=", "None", ",", "use_peepholes", "=", "False", ",", "name", "=", "'RNN_layer'", ")", ":", "for", "n"...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
u_shape
Network architecture inspired by One Hundred layer Tiramisu. https://arxiv.org/abs/1611.09326. U-Net like. Args: units: a tensorflow tensor with dimensionality [None, n_tokens, n_features] n_hidden_list: list with number of hidden units at the ouput of each layer fil...
deeppavlov/core/layers/tf_layers.py
def u_shape(units: tf.Tensor, n_hidden_list: List, filter_width=7, use_batch_norm=False, training_ph=None): """ Network architecture inspired by One Hundred layer Tiramisu. https://arxiv.org/abs/1611.09326. U-Net like. Args: units: a tenso...
def u_shape(units: tf.Tensor, n_hidden_list: List, filter_width=7, use_batch_norm=False, training_ph=None): """ Network architecture inspired by One Hundred layer Tiramisu. https://arxiv.org/abs/1611.09326. U-Net like. Args: units: a tenso...
[ "Network", "architecture", "inspired", "by", "One", "Hundred", "layer", "Tiramisu", ".", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1611", ".", "09326", ".", "U", "-", "Net", "like", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L237-L285
[ "def", "u_shape", "(", "units", ":", "tf", ".", "Tensor", ",", "n_hidden_list", ":", "List", ",", "filter_width", "=", "7", ",", "use_batch_norm", "=", "False", ",", "training_ph", "=", "None", ")", ":", "# Bread Crumbs", "units_for_skip_conn", "=", "[", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
stacked_highway_cnn
Highway convolutional network. Skip connection with gating mechanism. Args: units: a tensorflow tensor with dimensionality [None, n_tokens, n_features] n_hidden_list: list with number of hidden units at the output of each layer filter_width: width of the kernel in tokens use...
deeppavlov/core/layers/tf_layers.py
def stacked_highway_cnn(units: tf.Tensor, n_hidden_list: List, filter_width=3, use_batch_norm=False, use_dilation=False, training_ph=None): """ Highway convolutional network. Skip connection with ...
def stacked_highway_cnn(units: tf.Tensor, n_hidden_list: List, filter_width=3, use_batch_norm=False, use_dilation=False, training_ph=None): """ Highway convolutional network. Skip connection with ...
[ "Highway", "convolutional", "network", ".", "Skip", "connection", "with", "gating", "mechanism", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L288-L332
[ "def", "stacked_highway_cnn", "(", "units", ":", "tf", ".", "Tensor", ",", "n_hidden_list", ":", "List", ",", "filter_width", "=", "3", ",", "use_batch_norm", "=", "False", ",", "use_dilation", "=", "False", ",", "training_ph", "=", "None", ")", ":", "for"...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
embedding_layer
Token embedding layer. Create matrix of for token embeddings. Can be initialized with given matrix (for example pre-trained with word2ve algorithm Args: token_indices: token indices tensor of type tf.int32 token_embedding_matrix: matrix of embeddings with dimensionality ...
deeppavlov/core/layers/tf_layers.py
def embedding_layer(token_indices=None, token_embedding_matrix=None, n_tokens=None, token_embedding_dim=None, name: str = None, trainable=True): """ Token embedding layer. Create matrix of for token embeddings. ...
def embedding_layer(token_indices=None, token_embedding_matrix=None, n_tokens=None, token_embedding_dim=None, name: str = None, trainable=True): """ Token embedding layer. Create matrix of for token embeddings. ...
[ "Token", "embedding", "layer", ".", "Create", "matrix", "of", "for", "token", "embeddings", ".", "Can", "be", "initialized", "with", "given", "matrix", "(", "for", "example", "pre", "-", "trained", "with", "word2ve", "algorithm" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L335-L368
[ "def", "embedding_layer", "(", "token_indices", "=", "None", ",", "token_embedding_matrix", "=", "None", ",", "n_tokens", "=", "None", ",", "token_embedding_dim", "=", "None", ",", "name", ":", "str", "=", "None", ",", "trainable", "=", "True", ")", ":", "...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
character_embedding_network
Characters to vector. Every sequence of characters (token) is embedded to vector space with dimensionality char_embedding_dim Convolution plus max_pooling is used to obtain vector representations of words. Args: char_placeholder: placeholder of int32 type with dimensionality [B, T, ...
deeppavlov/core/layers/tf_layers.py
def character_embedding_network(char_placeholder: tf.Tensor, n_characters: int = None, emb_mat: np.array = None, char_embedding_dim: int = None, filter_widths=(3, 4, 5, 7), ...
def character_embedding_network(char_placeholder: tf.Tensor, n_characters: int = None, emb_mat: np.array = None, char_embedding_dim: int = None, filter_widths=(3, 4, 5, 7), ...
[ "Characters", "to", "vector", ".", "Every", "sequence", "of", "characters", "(", "token", ")", "is", "embedded", "to", "vector", "space", "with", "dimensionality", "char_embedding_dim", "Convolution", "plus", "max_pooling", "is", "used", "to", "obtain", "vector", ...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L371-L430
[ "def", "character_embedding_network", "(", "char_placeholder", ":", "tf", ".", "Tensor", ",", "n_characters", ":", "int", "=", "None", ",", "emb_mat", ":", "np", ".", "array", "=", "None", ",", "char_embedding_dim", ":", "int", "=", "None", ",", "filter_widt...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
expand_tile
Expand and tile tensor along given axis Args: units: tf tensor with dimensions [batch_size, time_steps, n_input_features] axis: axis along which expand and tile. Must be 1 or 2
deeppavlov/core/layers/tf_layers.py
def expand_tile(units, axis): """Expand and tile tensor along given axis Args: units: tf tensor with dimensions [batch_size, time_steps, n_input_features] axis: axis along which expand and tile. Must be 1 or 2 """ assert axis in (1, 2) n_time_steps = tf.shape(units)[1] repetitio...
def expand_tile(units, axis): """Expand and tile tensor along given axis Args: units: tf tensor with dimensions [batch_size, time_steps, n_input_features] axis: axis along which expand and tile. Must be 1 or 2 """ assert axis in (1, 2) n_time_steps = tf.shape(units)[1] repetitio...
[ "Expand", "and", "tile", "tensor", "along", "given", "axis", "Args", ":", "units", ":", "tf", "tensor", "with", "dimensions", "[", "batch_size", "time_steps", "n_input_features", "]", "axis", ":", "axis", "along", "which", "expand", "and", "tile", ".", "Must...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L433-L444
[ "def", "expand_tile", "(", "units", ",", "axis", ")", ":", "assert", "axis", "in", "(", "1", ",", "2", ")", "n_time_steps", "=", "tf", ".", "shape", "(", "units", ")", "[", "1", "]", "repetitions", "=", "[", "1", ",", "1", ",", "1", ",", "1", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
additive_self_attention
Computes additive self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <v, tanh(W_1 h_i + W_2 h_j)> v is a learnable vector of n_hidden dimensionality, W_1 and W_2 are learnable [n_hidden, n_input_features] matrices Args: units: tf tensor w...
deeppavlov/core/layers/tf_layers.py
def additive_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Computes additive self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <v, tanh(W_1 h_i + W_2 h_j)> v is a learnable vector of n_hidden dimensionality, W...
def additive_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Computes additive self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <v, tanh(W_1 h_i + W_2 h_j)> v is a learnable vector of n_hidden dimensionality, W...
[ "Computes", "additive", "self", "attention", "for", "time", "series", "of", "vectors", "(", "with", "batch", "dimension", ")", "the", "formula", ":", "score", "(", "h_i", "h_j", ")", "=", "<v", "tanh", "(", "W_1", "h_i", "+", "W_2", "h_j", ")", ">", ...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L447-L472
[ "def", "additive_self_attention", "(", "units", ",", "n_hidden", "=", "None", ",", "n_output_features", "=", "None", ",", "activation", "=", "None", ")", ":", "n_input_features", "=", "units", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", "2",...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
multiplicative_self_attention
Computes multiplicative self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <W_1 h_i, W_2 h_j>, W_1 and W_2 are learnable matrices with dimensionality [n_hidden, n_input_features], where <a, b> stands for a and b dot product Args: units:...
deeppavlov/core/layers/tf_layers.py
def multiplicative_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Computes multiplicative self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <W_1 h_i, W_2 h_j>, W_1 and W_2 are learnable matrices with dimensionality [...
def multiplicative_self_attention(units, n_hidden=None, n_output_features=None, activation=None): """ Computes multiplicative self attention for time series of vectors (with batch dimension) the formula: score(h_i, h_j) = <W_1 h_i, W_2 h_j>, W_1 and W_2 are learnable matrices with dimensionality [...
[ "Computes", "multiplicative", "self", "attention", "for", "time", "series", "of", "vectors", "(", "with", "batch", "dimension", ")", "the", "formula", ":", "score", "(", "h_i", "h_j", ")", "=", "<W_1", "h_i", "W_2", "h_j", ">", "W_1", "and", "W_2", "are"...
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L475-L501
[ "def", "multiplicative_self_attention", "(", "units", ",", "n_hidden", "=", "None", ",", "n_output_features", "=", "None", ",", "activation", "=", "None", ")", ":", "n_input_features", "=", "units", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "[", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_gru
Fast CuDNN GRU implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dimensionality of hidden state trainable_initial_states: whether to create a special trainable variable ...
deeppavlov/core/layers/tf_layers.py
def cudnn_gru(units, n_hidden, n_layers=1, trainable_initial_states=False, seq_lengths=None, input_initial_h=None, name='cudnn_gru', reuse=False): """ Fast CuDNN GRU implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number ...
def cudnn_gru(units, n_hidden, n_layers=1, trainable_initial_states=False, seq_lengths=None, input_initial_h=None, name='cudnn_gru', reuse=False): """ Fast CuDNN GRU implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number ...
[ "Fast", "CuDNN", "GRU", "implementation" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L504-L549
[ "def", "cudnn_gru", "(", "units", ",", "n_hidden", ",", "n_layers", "=", "1", ",", "trainable_initial_states", "=", "False", ",", "seq_lengths", "=", "None", ",", "input_initial_h", "=", "None", ",", "name", "=", "'cudnn_gru'", ",", "reuse", "=", "False", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_compatible_gru
CuDNN Compatible GRU implementation. It should be used to load models saved with CudnnGRUCell to run on CPU. Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dime...
deeppavlov/core/layers/tf_layers.py
def cudnn_compatible_gru(units, n_hidden, n_layers=1, trainable_initial_states=False, seq_lengths=None, input_initial_h=None, name='cudnn_gru', reuse=False): """ CuDNN Compatible GRU implementation. It should be used to load models saved with CudnnGRUCell to run on CPU. Arg...
def cudnn_compatible_gru(units, n_hidden, n_layers=1, trainable_initial_states=False, seq_lengths=None, input_initial_h=None, name='cudnn_gru', reuse=False): """ CuDNN Compatible GRU implementation. It should be used to load models saved with CudnnGRUCell to run on CPU. Arg...
[ "CuDNN", "Compatible", "GRU", "implementation", ".", "It", "should", "be", "used", "to", "load", "models", "saved", "with", "CudnnGRUCell", "to", "run", "on", "CPU", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L552-L604
[ "def", "cudnn_compatible_gru", "(", "units", ",", "n_hidden", ",", "n_layers", "=", "1", ",", "trainable_initial_states", "=", "False", ",", "seq_lengths", "=", "None", ",", "input_initial_h", "=", "None", ",", "name", "=", "'cudnn_gru'", ",", "reuse", "=", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_lstm
Fast CuDNN LSTM implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dimensionality of hidden state n_layers: number of layers trainable...
deeppavlov/core/layers/tf_layers.py
def cudnn_lstm(units, n_hidden, n_layers=1, trainable_initial_states=None, seq_lengths=None, initial_h=None, initial_c=None, name='cudnn_lstm', reuse=False): """ Fast CuDNN LSTM implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch siz...
def cudnn_lstm(units, n_hidden, n_layers=1, trainable_initial_states=None, seq_lengths=None, initial_h=None, initial_c=None, name='cudnn_lstm', reuse=False): """ Fast CuDNN LSTM implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch siz...
[ "Fast", "CuDNN", "LSTM", "implementation" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L624-L678
[ "def", "cudnn_lstm", "(", "units", ",", "n_hidden", ",", "n_layers", "=", "1", ",", "trainable_initial_states", "=", "None", ",", "seq_lengths", "=", "None", ",", "initial_h", "=", "None", ",", "initial_c", "=", "None", ",", "name", "=", "'cudnn_lstm'", ",...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_compatible_lstm
CuDNN Compatible LSTM implementation. It should be used to load models saved with CudnnLSTMCell to run on CPU. Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dim...
deeppavlov/core/layers/tf_layers.py
def cudnn_compatible_lstm(units, n_hidden, n_layers=1, trainable_initial_states=None, seq_lengths=None, initial_h=None, initial_c=None, name='cudnn_lstm', reuse=False): """ CuDNN Compatible LSTM implementation. It should be used to load models saved with CudnnLSTMCell to run on CPU...
def cudnn_compatible_lstm(units, n_hidden, n_layers=1, trainable_initial_states=None, seq_lengths=None, initial_h=None, initial_c=None, name='cudnn_lstm', reuse=False): """ CuDNN Compatible LSTM implementation. It should be used to load models saved with CudnnLSTMCell to run on CPU...
[ "CuDNN", "Compatible", "LSTM", "implementation", ".", "It", "should", "be", "used", "to", "load", "models", "saved", "with", "CudnnLSTMCell", "to", "run", "on", "CPU", "." ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L681-L746
[ "def", "cudnn_compatible_lstm", "(", "units", ",", "n_hidden", ",", "n_layers", "=", "1", ",", "trainable_initial_states", "=", "None", ",", "seq_lengths", "=", "None", ",", "initial_h", "=", "None", ",", "initial_c", "=", "None", ",", "name", "=", "'cudnn_l...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_bi_gru
Fast CuDNN Bi-GRU implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dimensionality of hidden state seq_lengths: number of tokens in each sample in the batch n_layers...
deeppavlov/core/layers/tf_layers.py
def cudnn_bi_gru(units, n_hidden, seq_lengths=None, n_layers=1, trainable_initial_states=False, name='cudnn_bi_gru', reuse=False): """ Fast CuDNN Bi-GRU implementation Args: units: tf.Tensor with dimen...
def cudnn_bi_gru(units, n_hidden, seq_lengths=None, n_layers=1, trainable_initial_states=False, name='cudnn_bi_gru', reuse=False): """ Fast CuDNN Bi-GRU implementation Args: units: tf.Tensor with dimen...
[ "Fast", "CuDNN", "Bi", "-", "GRU", "implementation" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L766-L817
[ "def", "cudnn_bi_gru", "(", "units", ",", "n_hidden", ",", "seq_lengths", "=", "None", ",", "n_layers", "=", "1", ",", "trainable_initial_states", "=", "False", ",", "name", "=", "'cudnn_bi_gru'", ",", "reuse", "=", "False", ")", ":", "with", "tf", ".", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_bi_lstm
Fast CuDNN Bi-LSTM implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dimensionality of hidden state seq_lengths: number of tokens in each sample in the batch n_layer...
deeppavlov/core/layers/tf_layers.py
def cudnn_bi_lstm(units, n_hidden, seq_lengths=None, n_layers=1, trainable_initial_states=False, name='cudnn_bi_gru', reuse=False): """ Fast CuDNN Bi-LSTM implementation Args: units: tf.Tensor wi...
def cudnn_bi_lstm(units, n_hidden, seq_lengths=None, n_layers=1, trainable_initial_states=False, name='cudnn_bi_gru', reuse=False): """ Fast CuDNN Bi-LSTM implementation Args: units: tf.Tensor wi...
[ "Fast", "CuDNN", "Bi", "-", "LSTM", "implementation" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L820-L869
[ "def", "cudnn_bi_lstm", "(", "units", ",", "n_hidden", ",", "seq_lengths", "=", "None", ",", "n_layers", "=", "1", ",", "trainable_initial_states", "=", "False", ",", "name", "=", "'cudnn_bi_gru'", ",", "reuse", "=", "False", ")", ":", "with", "tf", ".", ...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c
test
cudnn_stacked_bi_gru
Fast CuDNN Stacked Bi-GRU implementation Args: units: tf.Tensor with dimensions [B x T x F], where B - batch size T - number of tokens F - features n_hidden: dimensionality of hidden state seq_lengths: number of tokens in each sample in the batch ...
deeppavlov/core/layers/tf_layers.py
def cudnn_stacked_bi_gru(units, n_hidden, seq_lengths=None, n_stacks=2, keep_prob=1.0, concat_stacked_outputs=False, trainable_initial_states=False, ...
def cudnn_stacked_bi_gru(units, n_hidden, seq_lengths=None, n_stacks=2, keep_prob=1.0, concat_stacked_outputs=False, trainable_initial_states=False, ...
[ "Fast", "CuDNN", "Stacked", "Bi", "-", "GRU", "implementation" ]
deepmipt/DeepPavlov
python
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/core/layers/tf_layers.py#L872-L927
[ "def", "cudnn_stacked_bi_gru", "(", "units", ",", "n_hidden", ",", "seq_lengths", "=", "None", ",", "n_stacks", "=", "2", ",", "keep_prob", "=", "1.0", ",", "concat_stacked_outputs", "=", "False", ",", "trainable_initial_states", "=", "False", ",", "name", "="...
f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c