{"id":21188,"library":"dynet","title":"DyNet","description":"DyNet is the Dynamic Neural Network Toolkit, a C++ library with Python bindings for training neural networks, particularly focused on natural language processing. Current version 2.1.2 supports implicitly cast parameters as expressions, Python 3.8+, and advanced slicing. Release cadence is irregular.","status":"active","version":"2.1.2","language":"python","source_language":"en","source_url":"https://github.com/clab/dynet","tags":["deep learning","neural networks","nlp","C++ backend"],"install":[{"cmd":"pip install dynet","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Wildcard imports pollute namespace; convention is to import as dy.","wrong":"from dynet import *","symbol":"dynet","correct":"import dynet as dy"},{"note":"dynet.Model is not a submodule; directly import the class.","wrong":"import dynet.Model","symbol":"Model","correct":"from dynet import Model"}],"quickstart":{"code":"import dynet as dy\n\nmodel = dy.Model()\ntrainer = dy.SimpleSGDTrainer(model)\npW = model.add_parameters((2, 2))\npb = model.add_parameters(2)\n\nx = dy.vecInput(2)\ny = dy.scalarInput(0)\n\nfor epoch in range(5):\n    loss = dy.pickneglogsoftmax(pW.expr() * x, y)\n    loss.backward()\n    trainer.update()\n    print(f\"Epoch {epoch}: loss = {loss.value()}\")","lang":"python","description":"Minimal example: create a model, parameters, and perform a simple optimization loop."},"warnings":[{"fix":"Use `p` instead of `p.expr()` or `dy.parameter(p)`.","message":"In DyNet 2.1, parameters are implicitly cast to expressions. Do not call `dy.parameter(p)` or `p.expr()`; just use `p` directly.","severity":"gotcha","affected_versions":">=2.1"},{"fix":"Retrain models with v2.0+ or use a conversion script (if available).","message":"DyNet 2.0 removed dependency on Boost. Model files saved with v1.x are incompatible. You must re-train or convert models.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Call `dy.renew_cg()` at the start of each training iteration.","message":"Always call `dy.renew_cg()` before creating new computation graph nodes in a loop, otherwise memory usage grows unbounded.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2.1.2':27 '3.8':35 'advanc':37 'backend':49 'bind':14 'c':10,48 'cadenc':40 'cast':30 'current':25 'deep':43 'dynam':5 'dynet':1,2 'express':33 'focus':20 'implicit':29 'irregular':42 'languag':23 'learn':44 'librari':11 'natur':22 'network':7,18,46 'neural':6,17,45 'nlp':47 'paramet':31 'particular':19 'process':24 'python':13,34 'releas':39 'slice':38 'support':28 'toolkit':8 'train':16 'version':26","created_at":"2026-04-27T16:58:32.748867+00:00","updated_at":"2026-04-27T16:58:32.748867+00:00","problems":{"verify_error":"× Failed to build `dynet==2.1.2`\n  ├─▶ The build backend returned an error\n  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)\n\n      [stdout]\n      INFO:root:running bdist_wheel\n      INFO:root:running build\n      INFO:root:CMAKE_PATH=None\n      INFO:root:MAKE_PATH='/usr/bin/m"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.1.2","cli_name":"","cli_version":null,"type":"library","homepage":"https://dynet.io","github":"https://github.com/clab/dynet","docs":null,"changelog":null,"pypi":"https://pypi.org/project/dynet/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}