zoukankan      html  css  js  c++  java
  • Torch 的安装与基本用法

    本文安装仅限 ubuntu 系统。官方文档见:Getting started with Torch

    0. 简介

    • Torch 使用轻量级脚本语言 Lua 及其 C/CUDA 扩展模块实现,底层数值计算通过高效的 OpenMP/SSE/CUDA 加速;

    1. 安装

    进入命令行终端,分别执行下面三行的代码,

    git clone https://github.com/torch/distro.git ~/torch --recursive
    cd ~/torch; bash install-deps;
    ./install.sh

    install.sh脚本会自动将 torch 路径添加进 Path 变量,因此还需执行下述代码以刷新环境变量。

    # On Linux with bash
    source ~/.bashrc
    # On Linux with zsh
    source ~/.zshrc
    # On OSX or in Linux with none of the above.
    source ~/.profile

    2. 安装第三方库

    • $ luarocks list:查看已安装库;
    • $ luarocks install image:安装 image库;
      • $ luarocks list:再次查看是否已安装 image 库;

    3. torch 命令行环境

    在 ubuntu 命令行输入 th以进入 torch 的 repl (read-eval-print loop)环境。

    $ th
    
      ______             __   |  Torch7 
     /_  __/__  ________/ /   |  Scientific computing for Lua. 
      / / / _ / __/ __/ _   |  Type ? for help 
     /_/  \___/_/  \__/_//_/  |  https://github.com/torch 
                              |  http://torch.ch 
    
    • th> os.exit():退出;
  • 相关阅读:
    js 获取时间差
    linq 两个list合并处理,并分组
    单例模式 双锁
    2018年的读书清单
    感悟
    asp.net使用Microsoft.mshtml提取网页标题等解析网页
    //利用反射快速给Model实体赋值
    C# url接口调用
    多字段动态查询
    对图片的操作
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421451.html
Copyright © 2011-2022 走看看