Comments (4)
Here is a breaking test file seems to error for
Release v0.150.0 based on tensorflowv v2.15.0.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tensorflow.NumPy;
using System.Linq;
using Tensorflow;
using static Tensorflow.Binding;
namespace TensorFlowNET.UnitTest.Basics
{
[TestClass]
public class TensorTest
{
[TestMethod]
public void TensorIndexingTest()
{
var elements = new int[3]{1, 2 , 3};
var tensor = new Tensor(elements);
var firstElement = (int) tensor[0];
var secondElement = (int) tensor[1];
Assert.AreEqual(1, firstElement);
Assert.AreEqual(2, secondElement);
}
}
}
from tensorflow.net.
Hello, please create tensor from NDArray in your case. For more information about how to create a tensor, you can refer to the source code.
https://github.com/SciSharp/TensorFlow.NET/blob/master/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs
from tensorflow.net.
I was writing unit tests around a method that takes a 1D Tensor then extracts each element from it (each one still as a Tensor) I think the code above fails because the Tensor has not yet been calculated in a graph.
If I make this replacement in the test above it then passes:
var tensor = tf.constant(elements);
from tensorflow.net.
@Wanglongzhi2001 your right constructing the Tensor from NDArray also works fine, thankyou.
var raw_elements = new int[3]{1, 2 , 3};
var elements = np.array(raw_elements);
var tensor = new Tensor(elements);
I'll close the issue. What a great project. I'm finding using BARD rather than ChatGPT to help with coding works better as the code examples it generates are more up to date.
from tensorflow.net.
Related Issues (20)
- Is is possible to implement a custom metric to support R^2 i.e. "Coefficient of determination" for a regression task?
- entry point not found HOT 5
- After installing TensorFlow.NET, HOT 2
- [BUG Report]: Model. predict() program crashes HOT 1
- Is bidirectional for LSTM even supported ? I am getting empty ( in C#/Tensorflow.NET 0 parameters) [Question]: HOT 8
- [Question]: Loading Python EfficientNetV2B0 model HOT 1
- [Question]: How can I create a model with multiple outputs?
- [Question]: System.NotImplementedException in Tensorflow.Checkpoint.CheckpointPosition._queue_slot_variables
- [BUG Report]: Model.fit verbose is always set to 1. HOT 2
- [BUG Report]: Normalization layer, must call .adapt after load and save
- Breadth-first traversal of augmented graph view causes collection modification exception
- tensorflow.keras is missing NuGet package README file
- [BUG Report]: Cannot find backend on Apple Silicon mac HOT 2
- [Question]: How to use regularizer ?
- Error when running model.fit after upgrade tensorflow.net to v0.150 HOT 1
- [BUG Report]: EarlyStopping Callback Stops Training Prematurely Regardless of Performance Improvement
- [Feature Request]: TimeDistributed and Dot
- [Performance Issue]: 125x performance difference between Python and TensorFlow.NET HOT 5
- [Question]: How to achieve glass breakage detection
- System.Collections.Generic.KeyNotFoundException: The given key '1' was not present in the dictionary. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflow.net.