当前位置: 首页 > news >正文

有关Theano和PyTensor库

在这里插入图片描述

根据Github里面的介绍,PyTensor是源于Theano, Theano目前应该已经不再开发了,更新都是很多年前。 因此PyTensor在背景介绍中说

PyTensor is a fork of Aesara, which is a fork of Theano.

Theano和PyTensor都是计算相关的库,可以在CPU、GPU结构中进行计算。使用也非常相似
PyTensor目前用作PyMC的计算后端。

import theano
from theano import tensor# Declare two symbolic floating-point scalars
a = tensor.dscalar()
b = tensor.dscalar()# Create a simple expression
c = a + b# Convert the expression into a callable object that takes (a, b)
# values as input and computes a value for c
f = theano.function([a, b], c)# Bind 1.5 to 'a', 2.5 to 'b', and evaluate 'c'
assert 4.0 == f(1.5, 2.5)
import pytensor
from pytensor import tensor as pt# Declare two symbolic floating-point scalars
a = pt.dscalar("a")
b = pt.dscalar("b")# Create a simple example expression
c = a + b# Convert the expression into a callable object that takes `(a, b)`
# values as input and computes the value of `c`.
f_c = pytensor.function([a, b], c)assert f_c(1.5, 2.5) == 4.0
http://www.lryc.cn/news/322601.html

相关文章:

  • 用 Open-Sora 高效创作视频,让创意触手可及
  • Git版本管理工具
  • 微信小程序选择器picker的使用(省市区)
  • std::shared_ptr与std::make_unique在类函数中的使用
  • flutter 局部view更新,dialog更新进度,dialog更新
  • Lombok:@Delegate优化代码利器
  • 【C语言】对称密码——栅栏的加密和解密
  • 一、rv1126开发之视频输入和视频编码
  • 4.1 用源文件写汇编代码
  • Linux TCP参数——tcp_abort_on_overflow
  • jupyter notebook设置代码提示方法
  • Linux 一点查询资料
  • 如何快速搭建一个完整的vue2+element-ui的项目-二
  • 多语言LLM的状态:超越英语
  • kafka什么情况下会认为发送失败进而去重试
  • 不满足软件包要求‘transformers==4.30.2‘, ‘sse-starlette
  • C# 设置AutoScroll为true没效果的原因分析和解决办法
  • <Senior High School Math>: inequality question
  • 详解Python中Pytest和Unittest的区别
  • 零基础入门多媒体音频(1)-音频基础
  • 40 道高频 C++ 面试、笔试题及答案
  • 【07】进阶html5
  • Linux|centos7|postgresql数据库|yum和编译方式安装总结(全系版本)
  • C++提高笔记(五)---STL容器(set/multiset、map/multimap)
  • 详解main函数参数argc、argv及如何传参
  • 解释什么是Web组件化开发及其优势
  • 那些场景需要额外注意线程安全问题
  • (C语言)球球大作战
  • 高级数据结构 <AVL树>
  • 在springboot中利用Redis实现延迟队列