text:
Segmentation Fault (core dumped) on exit from unit test that imports tf.contrib.rnn

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 14.04
TensorFlow installed from (source or binary): Source
TensorFlow version (use command below): 1.0.0
Bazel version (if compiling from source): 0.4.4
CUDA/cuDNN version: 8.0/5110
GPU model and memory: GeForce GTX 980 Ti
Exact command to reproduce: python -m unittest discover -s tests -p "example_test.py"(see below for details)

Describe the problem
I am running Tensorflow code from within the Python unittest module. The individual unit-tests, each of which train a specific architecture, run successfully with an OK. However, I observed that given the above described system configuration, I receive a Segmentation Fault (core dumped) just before the program exits. And this leads to the overall test being marked as FAIL (despite the individual tests passing).
On further investigation, I observed that the segmentation fault can be prevented from occurring by preventing the tensorflow/contrib/rnn/python/ops/_gru_ops.so file from being loaded by the load_op_library function inside tensorflow.contrib.rnn.python.ops.gru_ops
Source code / logs
Say I have a folder my_code that contains a tests folder where my unit-tests are all located. The error can be reproduced by running an example_test.py (given below) within the unittest module using the call python -m unittest discover -s tests -p "example_test.py" from within the my_codedirectory. The filemy_code/tests/example_tests.py` contains the following:
import unittest
import tensorflow as tf

class SomeTestClass(unittest.TestCase):
    """Some docstring."""

    def test_something(self):
        print("Testing something...\n")
        print tf.contrib.rnn.LSTMCell
        session = tf.Session()
        session.close()

Note that the error occurs only when both session is created and there is a reference to tf.contrib.rnn.

I'm having the same problem - my python code that uses TensorFlow will segfault when the python process terminates. I'm also using TF 1.0.0, but haven't touched any of the source code.

@gunan, do you have any ideas on this?

I was able to reproduce this in 1.0.1, but I found that in the nightly build it works fine, so I'd recommend upgrading to at least 1.2.

I am using tensorflow-gpu binary and could not reproduce this with v1.1.0 (current PyPI version).
Log is here.

Yes - I don't see the problem in v1.1 or higher. However, our team is heavily using v1.0 and we won't be able to upgrade everything anytime soon....
For what it's worth, I found a temporary fix:
I have a train() method, in which i have something like
def train(self, ...):     self.get_model(...)     self.fit(...)
in which get_model() builds the model:
def get_model(self, ...):     tf.reset_default_graph()     self.tf_graph = tf.Graph()     with self.tf_graph.as_default():         build graph...(this is where I use tf.contrib.rnn)
and fit() trains the model:
def fit(self, ...):     with self.tf_graph.as_default():         self.sess = tf.Session()         self.sess.run(...)
The temporary fix I added was in train():
def train(self, ...):     _ = tf.Session()   # adding this makes the segfault go away     self.get_model(...)     self.fit(...)
What's interesting is the session returned from _ = tf.Session() is never used anywhere, because in fit() I make a new session and use that session.
Hopefully this helps anyone who's also stuck in v1.0 for the moment...

This issue is automatically closed due to lack of activity. Please re-open if this is still an issue for you. Thanks!

authors: andrewjylee aselle byronyi freakanth tensorflowbutler

repo: tensorflow/tensorflow


text:
float64 support for conv1d and conv2d

This is a feature request for float64 support with nn.conv1d, nn.conv2d, and nn.convolution. Also, conv1d does not correctly document which types it supports. See below for details.
conv1d (which seems to be a wrapper for conv2d) and conv2d throw a TypeError when passed float64 tensors. (I have only tested using a CPU; I don't have GPU access.) This occurs despite the fact that the documentation for conv1d claims support for float64. It is also worth mentioning that (at least on my CPU), conv1d seems to support float16 even though this isn't mentioned in the documentation.
conv3d does however seem to support float64. Fortunately, this can at least be used as a temporary workaround to obtain float64 support for 1d and 2d convolutions.

Command
float16
float32
float64

conv1d
works, but undocumented
works
TypeError, despite documentation

conv2d
works
works
TypeError

conv3d
TypeError
works
works

The above table summarizes the (rather inconsistent) current state of tensorflow's support for various types according to my tests on a CPU using the code below. convolution appears to be a wrapper for conv1d, conv2d, and conv3d, and thus fails on the same types for each dimension.
import tensorflow as tf
# t = tf.float16
# t = tf.float32
t = tf.float64
b, fw1, fw2, fw3, ic, oc, iw1, iw2, iw3 = range(2,11)
tf.nn.conv1d(tf.zeros([b, iw1, ic], t), tf.zeros([fw1, ic, oc], t), 1, "VALID")
tf.nn.conv2d(tf.zeros([b, iw1, iw2, ic], t), tf.zeros([fw1, fw2, ic, oc], t), [1]*4, "VALID")
tf.nn.conv3d(tf.zeros([b, iw1, iw2, iw3, ic], t), tf.zeros([fw1, fw2, fw3, ic, oc], t), [1]*5, "VALID")
tf.nn.convolution(tf.zeros([b, iw1, ic], t), tf.zeros([fw1, ic, oc], t), "VALID")
tf.nn.convolution(tf.zeros([b, iw1, iw2, ic], t), tf.zeros([fw1, fw2, ic, oc], t), "VALID")
tf.nn.convolution(tf.zeros([b, iw1, iw2, iw3, ic], t), tf.zeros([fw1, fw2, fw3, ic, oc], t), "VALID")

System information

Have I written custom code: No
OS Platform and Distribution: Arch Linux (up to date)
TensorFlow installed from: source
TensorFlow version: 1.3.0
Python version: 3.6.2
Bazel version: 0.5.4

Added a PR #12943 to address the above mentioned issues.

Marking as contributions welcome since there is a PR.

I've added support for conv2d float64 in e3468b56d323783fdfb79fa2d6c24effc58bcaa9

source: gharchive/issue

authors: brianwa84 kjslag reedwm yongtang

license_type: permissive

license_source: github-api


text:
tf.contrib.data.prefetch_to_device throws an error when used with tf.data.Iterator.from_structure

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
Yes
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
TensorFlow installed from (source or binary): binary
TensorFlow version (use command below): 1.8.0
Python version: 2.7.12
Bazel version (if compiling from source):
GCC/Compiler version (if compiling from source):
CUDA/cuDNN version:
GPU model and memory:
Exact command to reproduce:

Describe the problem
I'm using tf.data.Iterator.from_structure mechanism to switch between training/validation datasets during training
However, when tf.contrib.data.prefetch_to_device is added at the end of the dataset pipeline, the code crashes with the following error:
NotImplementedError: `prefetch_to_device()` must be the last transformation in a dataset pipeline.
Explicit one shot iterator works fine
Source code / logs
with tf.Graph().as_default():
    with tf.Session() as sess:
        dataset = tf.data.Dataset.range(10).apply(tf.contrib.data.prefetch_to_device('/cpu:0'))

        # 1) works fine
        iterator = dataset.make_one_shot_iterator()
        print sess.run(iterator.get_next())

        # 2) fails
        iterator = tf.data.Iterator.from_structure((tf.int64), ([]))
        sess.run(iterator.make_initializer(dataset))
        print sess.run(iterator.get_next())

0

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-34-dbae58b82de0> in <module>()
      6
      7         iterator = tf.data.Iterator.from_structure((tf.int64), ([]))
----> 8         sess.run(iterator.make_initializer(dataset))
      9         print sess.run(iterator.get_next())

/usr/local/lib/python2.7/dist-packages/tensorflow/python/data/ops/iterator_ops.pyc in make_initializer(self, dataset, name)
    306     with ops.colocate_with(self._iterator_resource):
    307       return gen_dataset_ops.make_iterator(
--> 308           dataset._as_variant_tensor(), self._iterator_resource, name=name)  # pylint: disable=protected-access
    309
    310   def get_next(self, name=None):

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/data/python/ops/prefetching_ops.pyc in _as_variant_tensor(self)
    289     # TODO(mrry): Investigate support for chaining further transformations after
    290     # the prefetch, including GPU support.
--> 291     raise NotImplementedError("`prefetch_to_device()` must be the last "
    292                               "transformation in a dataset pipeline.")
    293

NotImplementedError: `prefetch_to_device()` must be the last transformation in a dataset pipeline.

I guess, prefetching is still under development? Is there a temporary workaround for this kind of scenario?

I tried to handle this by using feedable iterators, but they are not supported either
training_handle = session.run(trainIterator.string_handle())
AttributeError: '_PrefetchToDeviceIterator' object has no attribute 'string_handle'

Nagging Assignee @rohan100jain: It has been 22 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

Nagging Assignee @rohan100jain: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

Nagging Assignee @rohan100jain: It has been 29 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

Nagging Assignee @rohan100jain: It has been 44 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

Please use CopyToDevice + Prefetch instead of prefetch_to_device
ds = ...
ds = ds.apply(prefetching_ops.copy_to_device("/gpu:0")).prefetch(1)

It has been 14 days with no activity and the awaiting response label was assigned. Is this still an issue?

It has been 29 days with no activity and the awaiting response label was assigned. Is this still an issue?

It has been 44 days with no activity and the awaiting response label was assigned. Is this still an issue?

We are closing this issue for now due to lack of activity. Please comment if this is still an issue for you. Thanks!

authors: fogelton rohan100jain svirg tensorflowbutler


text:
sparse_categorical_crossentropy of keras is not available

https://github.com/tensorflow/tensorflow/blob/0e53c66f338a60be5ea348fdeb7b19e5b579971f/tensorflow/python/keras/metrics.py#L57-L64
I don't know why sparse_categorical_crossentropy is NOT decorated by tf_export like binary_accuracy, sparse_top_k_categorical_accuracy and so on.
As a result , we have to explicitly import sparse_categorical_crossentropy
i.e. from tensorflow.keras.metrics import sparse_categorical_crossentropy
Thanks

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce
Mobile device

@tensorflowbutler I have complemented some information. Thanks

It seems a mistake. Would you like to create a Pull Request to fix it?

@facaiy  Thanks I will pull request soon

Nagging Assignee @tatianashp: It has been 15 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.

authors: facaiy raytroop tensorflowbutler


text:
fatal error: google/protobuf/inlined_string_field.h: No such file or directory  #include <google/protobuf/inlined_string_field.h>

Please go to Stack Overflow for help and support:
https://stackoverflow.com/questions/tagged/tensorflow
If you open a GitHub issue, here is our policy:

It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).
The form below must be filled out.
It shouldn't be a TensorBoard issue. Those go here.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
TensorFlow installed from (source or binary): source
TensorFlow version (use command below): Commit cac963862be3faa421c559f39033c9bfb3b27a51
Python version: 2.7
Bazel version (if compiling from source):
GCC/Compiler version (if compiling from source): N/A
CUDA/cuDNN version: N/A
GPU model and memory: N/A
Exact command to reproduce: N/A

You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
Describe the problem
Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.
Follow up to issue #22240. I was able to fix the absl issue by pulling and copying over the absl folder to the external folder but I think there is an issue with the protobufs.
After following this tutorial: https://tuatini.me/building-tensorflow-as-a-standalone-project/ and running the following command:
g++ -std=c++11 -Wl,-rpath='$ORIGIN/lib' -Iinclude -Llib main.cpp -ltensorflow_cc -o exec
I'm getting the error "This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer headers. Please update" and "google/protobuf/inlined_string_field.h: No such file or directory  #include <google/protobuf/inlined_string_field.h>"
After looking through the commits I think the protobuf url is outdated.

Source code / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.

~/Desktop/tensorflow/tensorflow/contrib/makefile/downloads/protobuf/src protoc --version gives libprotoc 3.5.0 but inlined_string_field.h is not in 3.5.0

Figured out a way around this and was able to run a custom c++ program with g++ outside the tensorflow repo without using bazel other than for building the .so files. I'll be posting a tutorial soon for anyone who needs it.

+1

/Desktop/tensorflow/tensorflow/contrib/makefile/downloads/protobuf/src protoc --version gives libprotoc 3.5.0 but inlined_string_field.h is not in 3.5.0 (generated after running build_all_linux.sh)

workspace.bzl downloads 3.6.0, i am trying to hardcode and revert to 3.5.0, have you tried that, does that work ?

Yeah you can do that or you can get the 3.6.0 protobufs from the protobuf github repo which is what I ended up doing.

@roshan-dongre Hi, can this issue be closed as you figured out a way to resolve this ?

I changed protobuf version here as 3.6.0 here and getting the same error and op?

Hi @roshan-dongre , Can you explain where exactly did you copy absl folder for fixing #22240 (Path for external folder) ?
" I was able to fix the absl issue by pulling and copying over the absl folder to the external folder "

Hi,
I'm facing a version issue trying to compile tensorflow-1.11.0 in order to use it in a C++ project.  I think the issue is that bazel use protobuf-3.6.0 in tensorflow/workspace.bzl but the tensorflow/contrib/makefile/download_dependencies.sh fetch version 3.5.0 thus when you follow the instructions where you copy the proto stuff in Tensorflow's install_dir, we get a version mismatch.

authors: SamuelLarkin achalshah20 dhingratul harshini-gadige roshan-dongre


text:
toco fails to convert to tflite "TypeError: 'NoneType' object has no attribute 'getitem'"

toco --graph_def_file=frozen_inference_graph.pb --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --output_file=oren.tflite --inference_type=QUANTIZED_UINT8 --input_type=FLOAT --input_arrays=ImageTensor --output_arrays=SemanticPredictions --input_shapes=1,321,321,3
2018-09-25 19:48:04.857732: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Traceback (most recent call last):
File "/home/obg1/.local/bin/toco", line 11, in
sys.exit(main())
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 370, in main
app.run(main=run_main, argv=sys.argv[:1])
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 366, in run_main
_convert_model(tflite_flags)
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/tflite_convert.py", line 143, in _convert_model
output_data = converter.convert()
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/lite.py", line 374, in convert
dump_graphviz_video=self.dump_graphviz_video)
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/convert.py", line 243, in toco_convert
*args, **kwargs)
File "/home/obg1/.local/lib/python2.7/site-packages/tensorflow/contrib/lite/python/convert.py", line 210, in build_toco_convert_protos
input_array.mean_value, input_array.std_value = quantized_input_stats[idx]
TypeError: 'NoneType' object has no attribute 'getitem'

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks.
Have I written custom code
OS Platform and Distribution
TensorFlow installed from
TensorFlow version
Bazel version
CUDA/cuDNN version
GPU model and memory
Exact command to reproduce
Mobile device

as you can see from the tensorflow/contrib/lite/python/convert.py, for --inference_type=QUANTIZED_UINT8,  --std_dev_values and  --mean_values are anticipated.

@obg2sens Is this issue resolved ?

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

@freedomtan @harshini-gadige @tofulawrence Hi, I'm wondering what are the mean_values and std_values? Are they values for the testing data, or the data I used during training? Thanks.

@ZJPUBG
This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there.
If you think we've misinterpreted a bug, please comment again with a clear explanation, as well as all of the information requested in the issue template. Thanks!

@harshini-gadige nvm, I found it in the comments of lite.py file. I hope you guys can have a more detailed tflite documentation for users, this will also help questions on StackOverflow to be answered more correctly.

authors: ZJPUBG freedomtan harshini-gadige obg2sens tensorflowbutler tofulawrence


text:
TPUEstimator function requires train_batch_size to be set when use_tpu is True

The TPUEstimator constructor requires train_batch_size to be set if use_tpu is True.
In cases when I only want to use a TPU estimator to predict, that means I have to pass in an arbitrary value in for train_batch_size. Looking deeper into the code, I can't pinpoint why train_batch_size needs to be set when on a TPU, but I'm assuming it's required somewhere deeper in the code.
It was very confusing for me, especially since the documentation is conflicting pull request #37.
Maybe an option should be added that if train_batch_size is not set, but one of the other two (eval and predict) are, then provide a warning and pass an arbitrary value for train_batch_size. Otherwise maybe be more clear with the documentation that train_batch_size must always be set when on a TPU, even if you are only predicting or evaluating.

TPU Estimator manages its own TensorFlow graph and session, so it is not compatible with TF2 behaviors.
We recommend that you migrate to the newer tf.distribute.TPUStrategy.
See the TPU guide for details.

Yes. tf.estimator is deprecated.

authors: MarkDaoust jaymody sachinprasadhs


text:
How to create new cuda stream in custom op

I've written a custom op for the GPU that takes X with shape (n,p) and Y with shape (m,p) and returns Z with shape (n,m).
In the backward pass, dX and dY are independent computations so I'd like to have launch two separate CUDA kernels and have them run in separate streams. I know the cuDNN RNN is capable of doing kernels in parallel but I cannot find the source code for how to do this. It seems the only usable stream is provided by the OpKernelContext.
Matrix multiplication must have a similar parallelism when doing the backward pass but I have not found anywhere in the source making use of multiple streams. This is essentially a reopening of this issue as there doesn't appear to a public answer

@chaaland, Please take a look at this doc. Thanks!

Thanks for the link. I've referenced this doc many times while developing the op but I don't see where it specifies how to generate two CUDA streams. The call to d.stream() just returns a stream that has already been created rather than creating a new stream (which is what I think I'd need).
I'm open to any other way to get the dX and dY computations running in parallel as well. Currently I have something like the below which appears to be running in serial
const cudaStream_t& cu_stream = GetCudaStream(ctx);
dx_bprop<<<griddim, blockdim, 0, cu_stream>>>(...);
dy_bprop<<<gridim, blockdim, 0, cu_stream>>>(...);

Any updates on this?

@gowthamkpr yes I'm familiar with the custom op repo. My issue is not with being able to compile a GPU operation as I've managed to get that working already. I'd like to know how (or if it's even possible at all) to launch two CUDA kernels in 2 different streams.
In CUDA this can be done with a simple malloc of a new stream and passing the string as the 4th argument to the kernel itself. TensorFlow seems to have its own management of memory and streams which I didn't want to interfere with by calling a CUDA malloc directly. The example given in the time_two_kernels.cu.cc shows just using a single stream d.stream() which is the case I have working currently. I notice there are other streams created for copying host to device, device to device and so on but I don't see the ability to have multiple streams for compute.
Is this just a fundamental limitation of TensorFlow? I can't find any examples of using multiple compute streams yet I can't think of a reason this shouldn't be possible given CUDA permits it

@gowthamkpr bump on this issue

@chaaland  afaik, currently TensorFlow runtime only creates a single compute stream per GPU device. Thought this might change in the future runtime, but I don't think anytime soon. cc: @iganichev

@yifeif is right. TensorFlow design today is fairly tied to the "there is a single compute stream" assumption. This is usually not a problem because CUDA kernels tend to operate on large enough pieces of data and utilize the whole GPU. Your use case will benefit from parallelism only if your data is too small. In this case, if this op is not a major part of the computation (e.g. done in a tight loop), you might end up saving just a few microseconds.
If you still believe that running in parallel will be beneficial enough, there are a couple of things you can try doing:

You can try putting both computations into the same kernel. A possible approach is to split your CUDA threads into two logical groups and make threads in group 1 do computation for dX and threads in group 2 do computation for dY.
A much more involved and likely slower approach is to create another stream in your kernel (you probably want to cache it somewhere), launch your work on both streams, synchronize the new stream to the one used by TensorFlow to make sure that the TensorFlow's stream will not proceed until all work on your stream is done.

@iganichev  Sounds like fusing the Op's backprop functor is the most straightforward approach. I was under the impression this would provide a perf benefit since as the thread blocks computing dX finish, threadblocks for dY could be scheduled. In my current implementation, all of the thread blocks for dX must finish before any work on dY can be done. Will just have to test and see if it makes any difference. Thanks for your help!

authors: chaaland gadagashwini iganichev yifeif


text:
Predict API does not work with VarLenFeature when batch inputs from different size

I thought this issue  was related to tensorflow / serving repo , but they told me it belongs to this repo, and hoped that put it here to discuss, so I created this issue

System information

Have I written custom code (as opposed to using a stock
example script provided in TensorFlow): No
OS Platform and Distribution (e.g.,Linux Ubuntu 16.04):  MacOS
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
TensorFlow installed from (source or binary): binary
TensorFlow version (use command below): 2.1.0
Python version: 2.7.13
Bazel version (if compiling from source):
GCC/Compiler version (if compiling fromsource):
CUDA/cuDNN version:
GPU model and memory:

Describe the current behavior
Predict API is not compatible with batch variable length inputs. Everything is ok when the input is just one instance, or multiple instances with the same length of a var length feature.
ps: Classify API works pretty good in this case.
I tried to generate the exact same model through Estimator, and tested the above situation through the Classify API, everything was perfect. But since TensorFlow 2.0, Predict API is the default and only signature of keras model. I really want to solve this problem, instead of switching back to using Estimator or custom signature. This problem has troubled me for a while, thank you very much for your help :)
Describe the expected behavior
Predict API should be as compatible with variable length input features as Classify API
Source code / logs
Here is a simple code to reproduce this, which will output a model and serving from it.
[code]
import tensorflow as tf

# generate dummy dataset
def serialize_example(val, label):
    features = {
      'color': tf.train.Feature(bytes_list=tf.train.BytesList(value=val)),
      'label': tf.train.Feature(int64_list=tf.train.Int64List(value=[label]))
    }
    example_proto = tf.train.Example(features=tf.train.Features(feature=features))
    return example_proto.SerializeToString()

tfrecord_writer = tf.io.TFRecordWriter('./color.tfrecord')
for val, label in [([b'G', b'R'], 1), ([b'B'], 1), ([b'B', b'G'], 0), ([b'R'], 1)]:
    tfrecord_writer.write(serialize_example(val, label))
tfrecord_writer.close()

# load the data generate above
def parse(example_proto):
    feature_description = {
        'color': tf.io.VarLenFeature(tf.string) ,           # ** VarLenFeature **
        'label': tf.io.FixedLenFeature([], tf.int64)
    }
    parsed_features = tf.io.parse_single_example(example_proto, feature_description)
    labels = parsed_features.pop('label')
    return parsed_features, labels

dataset = tf.data.TFRecordDataset('./color.tfrecord').map(parse).repeat(5).batch(2)

# feature column & inputs.
color_cat = tf.feature_column.categorical_column_with_vocabulary_list(
                    key='color', vocabulary_list=["R", "G", "B"])

color_emb = tf.feature_column.embedding_column(color_cat, dimension=4, combiner='mean')

inputs = {
    'color': tf.keras.layers.Input(name='color', shape=(None, ), sparse=True, dtype=tf.string)
}

# build model
deep = tf.keras.layers.DenseFeatures([color_emb, ])(inputs)
output = tf.keras.layers.Dense(1, activation='sigmoid', name='output')(deep)
model = tf.keras.Model(inputs, output)
model.compile(optimizer='adam', loss='binary_crossentropy')

model.summary()

model.fit(dataset, epochs=5)
model.save('./dummy_model', save_format='tf')

[output log]
Model: "model"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
color (InputLayer)           [(None, None)]            0
_________________________________________________________________
dense_features (DenseFeature (None, 4)                 12
_________________________________________________________________
output (Dense)               (None, 1)                 5
=================================================================
Total params: 17
Trainable params: 17
Non-trainable params: 0
_________________________________________________________________
Epoch 1/5
10/10 [==============================] - 1s 119ms/step - loss: 0.7157
Epoch 2/5
10/10 [==============================] - 0s 4ms/step - loss: 0.7045
Epoch 3/5
10/10 [==============================] - 0s 4ms/step - loss: 0.6977
Epoch 4/5
10/10 [==============================] - 0s 5ms/step - loss: 0.6911
Epoch 5/5
10/10 [==============================] - 0s 5ms/step - loss: 0.6847
WARNING:tensorflow:From /Users/felix/Envs/tf2/lib/python2.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1781: calling __init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
INFO:tensorflow:Assets written to: ./dummy_model/assets

[saved_model signature]
$ saved_model_cli show --dir ./ --all
--------------------------------------------------------------------------
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:

signature_def['__saved_model_init_op']:
  The given SavedModel SignatureDef contains the following input(s):
  The given SavedModel SignatureDef contains the following output(s):
    outputs['__saved_model_init_op'] tensor_info:
        dtype: DT_INVALID
        shape: unknown_rank
        name: NoOp
  Method name is:

signature_def['serving_default']:
  The given SavedModel SignatureDef contains the following input(s):
    inputs['color'] tensor_info:
        dtype: DT_STRING
        shape: (-1, -1)
        name: serving_default_color:0
  The given SavedModel SignatureDef contains the following output(s):
    outputs['output'] tensor_info:
        dtype: DT_FLOAT
        shape: (-1, 1)
        name: StatefulPartitionedCall_8:0
  Method name is: tensorflow/serving/predict

Exact Steps to Reproduce

let me say there are two examples with the same shape , these work pretty good

curl -XPOST 0.0.0.0:8501/v1/models/dummy_model:predict -d '
{
  "inputs": {
    "color": [
      ["R"],
      ["G"]
    ]
  }
}'
----- response ----
{
    "outputs": [
        [
            0.370285
        ],
        [
            0.49326694
        ]
    ]
}

====================================================
curl -XPOST 0.0.0.0:8501/v1/models/dummy_model:predict -d '
{
  "inputs": {
    "color": [
      ["R", "G"],
      ["G", "B"]
    ]
  }
}'
------- response ---------
{
    "outputs": [
        [
            0.430707693
        ],
        [
            0.558493555
        ]
    ]
}

batch examples with different shape , does not work as expected

curl -XPOST 0.0.0.0:8501/v1/models/dummy_model:predict -d '
{
  "inputs": {
    "color": [
      ["R"],
      ["G", "B"]
    ]
  }
}'
-------- response -------

{ "error": "Encountered list at unexpected size: 2 at level: 1 expected size: 1" }

"instances" key also not works

curl -XPOST 0.0.0.0:8501/v1/models/dummy_model:predict -d '
{
  "instances": [
    {"color": ["R"]},
    {"color": ["G", "B"]}
  ]
}'

--------- response -----------
{ "error": "Failed to process element: 1 key: color of \'instances\' list. Error: Invalid argument: Expecting tensor size: 1 but got: 2" }

@gowthamkpr

Hi, guys. Any update on this? I'm also interested in seeing this issue resolved. Facing the save behaviour. Let me know if you need more details to fix it. Thanks in advance!

Is the problem solved, can you share the result?

Was able to replicate the issue with TF v2.5,please find the gist here ..Thanks!

in estimator it can work, but in keras it doesn't.
https://colab.research.google.com/gist/sushreebarsa/828257b5977439dea95ee3d48bcab242/untitled105.ipynb#scrollTo=45EerngFwltz

Was able to replicate the issue with TF v2.7, please find the gist here ..Thanks!

Hi There,
This is a stale issue. As you are using an older version of tensorflow, we are checking to see if you still need help on this issue. Please test the issue with the latest TensorFlow (TF2.7 and tf-nightly). If the issue still persists with the newer versions of TF, please feel free to open it in keras-team/keras repository by providing details about the issue and a standalone code to reproduce the issue. Thanks!
Please note that Keras development has moved to a separate Keras-team/keras repository to focus entirely on only Keras. Thanks!

Is the problem solved?  :(

Hi @FelixHo, were you able to solve this problem?

authors: DmitriyBaykov FelixHo cpy18727 kumariko nithish08 rabintang sushreebarsa tensorflowbutler zhangmingnine


text:
bulid tensorflow failed

I follow the instrctons in the "https://tensorflow.google.cn/federated/install".
(1)Install TensorFlow Federated using pip: When I run the command "python -c "import tensorflow_federated as tff; print(tff.federated_computation(lambda: 'Hello World')())"" , there is a SyntaxError: invalid syntax os
(2)Using Docker: When I run the command "docker build .  --tag tensorflow_federated", it always fails.
These two errors are shown in the shapshot.

This issue more suitable on TensorFlow Federated repository. Thanks!

Closing as not an issue of main TensorFlow. Please reopen on TensorFlow Federated

authors: mihaimaruseac whyseu ymodak


text:
Tensorflow 2.0 Object detection GPU fails

Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information

OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: None
TensorFlow installed from (source or binary):  binary
TensorFlow version: Tensorflow-gpu 2.0.2
Python version: 3.6
Installed using virtualenv? pip? conda?: pip
Bazel version (if compiling from source): None
GCC/Compiler version (if compiling from source): None
CUDA/cuDNN version: 10.0/7.6.0
GPU model and memory: GeForce 930MX
Describe the current behavior
Hi.
I'm trying to do an object detection tutorial from this, however I get the following output without success:
(tfflask) C:\Users\DELL\Downloads\models-master\research\object_detection>python test_object.py 2020-06-04 21:02:11.627763: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll 2020-06-04 21:02:14.271146: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2020-06-04 21:02:14.688585: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: name: GeForce 930MX major: 5 minor: 0 memoryClockRate(GHz): 1.0195 pciBusID: 0000:03:00.0 2020-06-04 21:02:14.694154: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check. 2020-06-04 21:02:14.700750: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0 [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')] 2020-06-04 21:02:16.474139: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2020-06-04 21:02:16.555975: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: name: GeForce 930MX major: 5 minor: 0 memoryClockRate(GHz): 1.0195 pciBusID: 0000:03:00.0 2020-06-04 21:02:16.567918: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check. 2020-06-04 21:02:16.576144: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0 2020-06-04 21:04:34.299345: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix: 2020-06-04 21:04:34.303521: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 2020-06-04 21:04:34.305504: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N 2020-06-04 21:04:34.311931: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1384 MB memory) -> physical GPU (device: 0, name: GeForce 930MX, pci bus id: 0000:03:00.0, compute capability: 5.0) 2020-06-04 21:04:41.840234: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll 2020-06-04 21:04:42.605329: W tensorflow/stream_executor/cuda/redzone_allocator.cc:312] Internal: Invoking ptxas not supported on Windows Relying on driver to perform ptx compilation. This message will be only logged once. 2020-06-04 21:04:43.557938: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.06GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available. 2020-06-04 21:04:43.829741: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.09GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available. 2020-06-04 21:04:44.020239: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.15GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available. 2020-06-04 21:04:44.422733: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.27GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.

Is the memory overloading? I tried inserting:
`physical_devices = tf.compat.v1.config.experimental.list_physical_devices('GPU')
tf.compat.v1.config.experimental.set_memory_growth(physical_devices[0], True)`
but to no avail.

Never mind , I figured it out. All i had to do was update the version of CUDA to 10.1, tensorflow-gpu to tensorflow-gpu-2.2 and keep the CudNN as is. Installing. Installing Microsoft Visual Studio Redistributable helped tensorflow-gpu 2.2 to get the required .dll's which are required after upgrading to tensorflow-gpu >2.0. I'm closing the issue now.


text:
tf.GradientTape.gradients() does not support graph control flow operations like tf.cond or tf.while at this time. Use tf.gradients() instead. If you need this feature, please file a feature request at https://github.com/tensorflow/tensorflow/issues/new

Please go to Stack Overflow for help and support:
https://stackoverflow.com/questions/tagged/tensorflow
If you open a GitHub issue, here is our policy:

It must be a bug, a feature request, or a significant problem with the
documentation (for small docs fixes please send a PR instead).
The form below must be filled out.
It shouldn't be a TensorBoard issue. Those go
here.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.

System information

Have I written custom code (as opposed to using a stock example script
provided in TensorFlow):
OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue
happens on a mobile device:
TensorFlow installed from (source or binary):
TensorFlow version (use command below):
Python version:
Bazel version (if compiling from source):
GCC/Compiler version (if compiling from source):
CUDA/cuDNN version:
GPU model and memory:
Exact command to reproduce:

You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with:
python -c "import tensorflow as tf; print(tf.version.GIT_VERSION, tf.version.VERSION)"

Describe the problem
Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.
Source code / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.

Can you fill the ISSUE template with all the info required? Thanks

Duplicate issue : #36581 #31504
Could you please fill the issue template.Also Please provide the simple standalone code/ colab link to reproduce the issue at our end.Thanks

authors: CHIJUI0128 bhack saikumarchalla


text:
parameters in XML file comparison

Issue Type
Support
Source
binary
Tensorflow Version
1.15
Custom Code
No
OS Platform and Distribution
Windows 10
Mobile device
No response
Python version
3.7.9
Bazel version
No response
GCC/Compiler version
gcc (MinGW.org GCC-6.3.0-1) 6.3.0
CUDA/cuDNN version
10.0, V10.0.130
GPU model and memory
NVIDIA GeForce RTX 2060 6GB
Hello,
i am a bit unsure about the new xml file i created with a labelling tool. the first example is a tool that doesn't support object tracking, meaning you have to mark each object yourself. in the second example (i use) you can see that more parameters are added. now i wanted to know if there can be any problems with the creation of the tfrecord files?
the normal process is:
xml file -> csv file -> tfrecord
the following scripts are used for this:
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/blob/master/xml_to_csv.py /
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/blob/master/generate_tfrecord.py
are the parameters ignored by the python script and only read which are defined?
standard xml file:
<annotation>
	<folder>train</folder>
	<filename>IMG_2385.JPG</filename>
	<path>C:\tensorflow_cards\train\IMG_2385.JPG</path>
	<source>
		<database>Unknown</database>
	</source>
	<size>
		<width>378</width>
		<height>504</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>king</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>92</xmin>
			<ymin>183</ymin>
			<xmax>223</xmax>
			<ymax>348</ymax>
		</bndbox>
	</object>
</annotation>

new xml file:

<annotation>
  <folder>image</folder>
  <filename>image_14.jpg</filename>
  <source>
    <database>Unknown</database>
    <annotation>Unknown</annotation>
    <image>Unknown</image>
  </source>
  <size>
    <width>720</width>
    <height>720</height>
    <depth></depth>
  </size>
  <segmented>0</segmented>
  <object>
    <name>person</name>
    <truncated>0</truncated>
    <occluded>0</occluded>
    <difficult>0</difficult>
    <bndbox>
      <xmin>281.22</xmin>
      <ymin>688.92</ymin>
      <xmax>323.7</xmax>
      <ymax>718.45</ymax>
    </bndbox>
    <attributes>
      <attribute>
        <name>rotation</name>
        <value>0.0</value>
      </attribute>
      <attribute>
        <name>track_id</name>
        <value>63</value>
      </attribute>
      <attribute>
        <name>keyframe</name>
        <value>True</value>
      </attribute>
    </attributes>
  </object>
</annotation>

@Petros626 TF v1.x is not actively supported. You are using TF v1.15, we recommend you to use TF v2.4 or later version and let us know if you face the issue in latest versions.
Thank you!

@Petros626 TF v1.x is not actively supported. You are using TF v1.15, we recommend you to use TF v2.4 or later version and let us know if you face the issue in latest versions. Thank you!

Yes I know, but I will use this version, because I use a model from the first model zoo. There was no case I was confronted with a problem, I only asking if I use this xml file if the two scripts not working with or the pasted params to the scripts will work.

@Petros626 Please go through this amazing example of converting an xml file to tfrecord file. This should give you a clear understanding. Thanks!

authors: Petros626 gowthamkpr sushreebarsa


text:
Can't find rt.jar when installing tensorflow on Mac OS

Hi,
I downloaded and installed jdk 8 on my mac os. But there was no classes.jar or rt.jar shipped with the installation. When I tried to install tensorflow afterwards, I got a could not find rt.jar error. How should I fix this ?

Since TensorFlow doesn't use any Java, are you referring to a problem with Bazel?  You could also the Bazel folk, but I expect the problem is better suited for StackOverflow.  Wherever you ask it, please post complete error messages.


text:
Bug of CPU detection?

System information
Linux 4.9.0-kali4-686-pae #1 SMP Debian 4.9.25-1kali1 (2017-05-04) i686 GNU/Linux
TensorFlow installed from source code
TensorFlow version : 1.0.1
Bazel version : 0.4.2
CUDA/cuDNN version: None
GPU model and memory: None

== cat /etc/issue ===============================================
Linux 4.9.0-kali4-686-pae #1 SMP Debian 4.9.25-1kali1 (2017-05-04) i686 GNU/Linux
VERSION="2017.1"
VERSION_ID="2017.1"
== are we in docker =============================================
No
== compiler =====================================================
c++ (Debian 6.3.0-16) 6.3.0 20170425
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
== uname -a =====================================================
Linux 4.9.0-kali4-686-pae #1 SMP Debian 4.9.25-1kali1 (2017-05-04) i686 GNU/Linux
== check pips ===================================================
numpy (1.12.1)
== check for virtualenv =========================================
False
== tensorflow import ============================================
Traceback (most recent call last):
File "", line 1, in
File "tensorflow/init.py", line 24, in
from tensorflow.python import *
File "tensorflow/python/init.py", line 72, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "tensorflow/python/init.py", line 61, in
from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name pywrap_tensorflow
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
== env ==========================================================
LD_LIBRARY_PATH is unset
DYLD_LIBRARY_PATH is unset
== nvidia-smi ===================================================
== cuda libs  ===================================================

Describe the problem
I compiled it from source,  and got this fatal error when try to import tensorflow in python3.5.3:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
F tensorflow/core/platform/cpu_feature_guard.cc:35] The TensorFlow library was compiled to use SSE instructions, but these aren't available on your machine.
Aborted

And here is the information of my CPU:
.......
processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 37
model name    : Intel(R) Core(TM) i3 CPU       M 370  @ 2.40GHz
stepping    : 5
microcode    : 0x4
cpu MHz        : 933.000
cache size    : 3072 KB
physical id    : 0
siblings    : 4
core id        : 2
cpu cores    : 2
apicid        : 5
initial apicid    : 5
fdiv_bug    : no
f00f_bug    : no
coma_bug    : no
fpu        : yes
fpu_exception    : yes
cpuid level    : 11
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology nonstop_tsc aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 popcnt lahf_lm tpr_shadow vnmi flexpriority ept vpid dtherm arat
bugs        :
bogomips    : 4787.91
clflush size    : 64
cache_alignment    : 64
address sizes    : 36 bits physical, 48 bits virtual
......

that's all.

@petewarden Any idea what's happening here?  Core i3 certainly has SSE, as indicated in the flags.

FYI I'm also seeing this (and I'm also using i686).
I don't understand these things so could be wrong, but it seems like PLATFORM_IS_X86 isn't set when building on i686 with gcc [1][2], and if PLATFORM_IS_X86 isn't set then the CPU info checks fail fast [3].
[1] https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/platform.h#L59
[2] https://sourceforge.net/p/predef/wiki/Architectures/
[3] https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/platform/cpu_info.cc#L313

Unfortunately we don't test on 32-bit x86 here, since it's not an officially supported platform and we don't have machines set up, so it's hard for us to do a fix. We'd welcome a PR with an update though, I'm guessing adding the right macro check at [1] would get things running?

Actually, I take that back. We do have a supported platform we can test on, older iPhone emulators use 32-bit x86, as shown in bug #8914. Since we're tracking this issue there, closing this as a duplicate.

authors: c-cccc charmasaur girving petewarden


text:
Allow tfexample_decoder.BoundingBox to be created from dense tensor

Modife the .tensor_to_items() method on the BoundingBox so that it
can be created from dense tensors, as well as sparse tensors (which are
currently required).

Can one of the admins verify this patch?

Jenkins, test this please

@tensorflow-jenkins test this please

Test failure unrelated to code change.

source: gharchive/pull-request

authors: flacjacket frankchn rmlarsen sb2nov tensorflow-jenkins


text:
systemlibs: Unbundle protobuf

Use system_link_files for protobuf.bzl. The protobuf.bzl file is taken
verbatim from the protobuf repo. This version of protobuf.bzl will only
be used when opting into using the system version of protobuf and is off
by default.
Signed-off-by: Jason Zaman jason@perfinion.com
I've had this patch in the Gentoo package for TF for the last several versions and not had any issues reported.
@gunan @angersson for review

Cool, it got merged without any problems. Thanks!

authors: angersson perfinion


text:
Add documentation about Dataset shard's deterministic nature

Hi everyone,
This pull request addresses the issue raised in issue #31698.
Specifically, I have edited the documentation so that it clearly mentions that the shard operation in the Dataset API is deterministic.
Here is the file containing the implementation of shard in r2.0.
If I understand correctly, this line dictates exactly how the target Dataset is split into its "shards".
Please let me know your feedback.
Thanks for your time.

@aaudiber sorry this was merged automatically , @anubh-v do you want to address @aaudiber in a new PR if not i can take up this internally , thank you for your contribution.

Thanks @aaudiber, I will raise a new PR to make the suggested changes.

authors: anubh-v rthadur


text:
Type inference using type annotations

Performs type inference using type annotations.
A dictionary with variable names mapped to a list of possible types is added to the AST nodes.
Example
def f(x: tf.Tensor, a: int):
  if y > 0:
    y = x + y
  return y

The AST will be annotated with:
y = x + y:
___pyct_anno={SCOPE: Scope{r=(x, y,), w=(y,)}, 'type_anno_read': {x: {tf.Tensor}, y: {int}}, 'type_anno_write': {y: {tf.Tensor}}}

return y:
___pyct_anno={SCOPE: Scope{r=(y,), w=()}, 'type_anno_read': {y: {tf.Tensor, int}}, 'type_anno_write': {}}

Note: This is experimental and does not infer types for variables assigned to a python object.

@rahul-kamat can you please check ubuntu sanity build failures ?

It has been 15 days with no activity and the awaiting response label was assigned. Is this PR still valid? Assigning the stalled label. Please comment to reassure me that this is still being worked on.

The PR is still valid, but we've been delayed on the integration.

Hi @rahul-kamat, @mdanatg I'm going to go ahead and close this PR, because it seems to have stalled. If you're still interested in pursing this (and responding to my comments), please feel free to reopen! Thank you for your contribution!

authors: gbaned mdanatg rahul-kamat rthadur tensorflowbutler


text:
use std::make_tuple instead of non-empty braced-init-lists

Non-empty braced-init-lists cause some errors when I build from source. I don't know the exact reason. It may be related to my build tools, but the safest way is not to use non-empty braced-init-lists.
The error is:
external/org_tensorflow/tensorflow/stream_executor/gpu/asm_compiler.cc: In function ‘void stream_executor::LogPtxasTooOld(const string&, int, int)’:
external/org_tensorflow/tensorflow/stream_executor/gpu/asm_compiler.cc:190:62: error: converting to ‘absl::lts_2020_02_25::container_internal::raw_hash_set<absl::lts_2020_02_25::container_internal::FlatHashSetPolicy<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, absl::lts_2020_02_25::hash_internal::Hash<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::equal_to<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> > >::init_type {aka std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>}’ from initializer list would use explicit constructor ‘constexpr std::tuple< <template-parameter-1-1> >::tuple(_UElements&& ...) [with _UElements = {const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int&, int&}; <template-parameter-2-2> = void; _Elements = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int}]’
   if (already_logged->insert({ptxas_path, cc_major, cc_minor}).second) {

https://github.com/google/jax/issues/6046#issuecomment-809613061 reported a same error.
Using std::make_tuple instead makes the error disappear.

Out of curiosity, what was the error for cupti_tracer.cc?
Using std::make_tuple makes sense. FWIW I think another pair of curly braces will fix the compiler's confusion:
-  if (already_logged->insert({ptxas_path, cc_major, cc_minor}).second) {
+  if (already_logged->insert({{ptxas_path, cc_major, cc_minor}}).second) {

It's a similar error in cupti_tracer.cc (sorry I didn't record the log). These lines work fine in v2.4.1 using make_tuple:
https://github.com/tensorflow/tensorflow/blob/85c8b2a817f95a3e979ecd1ed95bff1dc1335cff/tensorflow/core/profiler/internal/gpu/cupti_tracer.cc#L156-L232
And 60b9283c9e5308bae6fe19d2db531a6c230baffd breaks it. So I just reverted them.

I think the changes from asm_compiler.cc (curly braces confuses a flat_hash_map of tuple) makes sense so +1 to the changes there. I think that is the same error as the JAX issue over at  https://github.com/google/jax/issues/6046#issuecomment-800439215.
However, regarding cupti_tracer.cc (curly braces for initializing tuple directly, no hash maps), it is not clear to me whether the changes fixes anything. Could we either revert cupti_tracer.cc here and isolate it into a separate PR? This way the asm_compiler.cc fix can go in first.

By the way, thanks for the investigation + fix, @njzjz!

Ok, I've reverted changes to cupti_tracer.cc. You are welcome!

authors: njzjz yisitu


text:
[iOS] Add initial xcframework bazel support

This adds xcframework support for 2 of the core libraries now that the
public bazel rules support producing static framework based
xcframeworks. This forks the hide symbols script to be compatible with
operating on multiple frameworks inside a given xcframework. Currently
this rules feature requires bazel 6.x rolling releases because it uses a
new API from the C++ starlark migration. That release should be public
in the next few months, for now this doesn't affect 5.x because the new
targets are manual.

Depends on this https://github.com/tensorflow/tensorflow/pull/56787 but I submitted them separately in case there is long running feedback here

One gotcha for googlers, the public xcframework rules don't match what's internal at google, the public rules support producing static framework based xcframeworks where as far as I know the internal rules require you to produce a static library based xcframework instead. Considering you're shipping static framework xcframeworks with releases somehow, I imagine you can keep doing that however you are, and ignore these rules internally.

Depends on https://github.com/pytorch/cpuinfo/pull/105, but I can probably pull that in as a patch

Added the patch for now, this actually broke when https://github.com/tensorflow/tensorflow/pull/56446 merged, which is why I didn't initially have this issue

@keith Can you please resolve conflicts? Thank you!

Resolved!

Hi @yishuangP Can you please review this PR ? Thank you!

Ok finally updated with a working version

the failure here is because of the bazel 5.x vs 6.x issue, we might have to wait, i was hoping the manual tags would be enough, but something is evaluating these still

Hi @yishuangP Can you please review this PR ? Thank you!

Hi some updates on this. I noticed that this PR broke a couple internal jobs. Will resolve them and send out a patch.

Hi @keith, is it necessary to update bazel apple rules version? I'm seeing couple errors:
Error in transition: Invalid transition input '//command_line_option:incompatible_enable_apple_toolchain_resolution'. Cannot transition on --experimental_* or --incompatible_* options
ERROR: /[tmpfs/tensor_flow/tensorflow/lite/java/BUILD:193](https://cs.corp.google.com/piper///depot/google3/tmpfs/tensor_flow/tensorflow/lite/java/BUILD?l=193&cl=513091613):13: error loading package 'tensorflow/lite/delegates/gpu': at /[tmpfs/bazel_output/_bazel_kbuilder/9a46bec5c8e82ceb5b4b229201d44d70/external/build_bazel_rules_apple/apple/ios.bzl:22](https://cs.corp.google.com/piper///depot/google3/tmpfs/bazel_output/_bazel_kbuilder/9a46bec5c8e82ceb5b4b229201d44d70/external/build_bazel_rules_apple/apple/ios.bzl?l=22&cl=513091613):5: at /[tmpfs/bazel_output/_bazel_kbuilder/9a46bec5c8e82ceb5b4b229201d44d70/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl:18](https://cs.corp.google.com/piper///depot/google3/tmpfs/bazel_output/_bazel_kbuilder/9a46bec5c8e82ceb5b4b229201d44d70/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl?l=18&cl=513091613):5: initialization of module 'apple/internal/transition_support.bzl' failed and referenced by '//tensorflow/lite/java:tensorflow-lite-gpu'

ERROR: C:/[workspace/WORKSPACE:23](https://cs.corp.google.com/piper///depot/google3/workspace/WORKSPACE?l=23&cl=513091613):14: error loading package '@com_github_grpc_grpc//src/compiler': at C:/[tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:28](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl?l=28&cl=513091613):6: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl:22](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl?l=22&cl=513091613):5: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl:18](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl?l=18&cl=513091613):5: initialization of module 'apple/internal/transition_support.bzl' failed and referenced by '//external:grpc_cpp_plugin'
ERROR: C:/[workspace/WORKSPACE:23](https://cs.corp.google.com/piper///depot/google3/workspace/WORKSPACE?l=23&cl=513091613):14: error loading package '@com_github_grpc_grpc//src/compiler': at C:/[tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:28](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl?l=28&cl=513091613):6: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl:22](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl?l=22&cl=513091613):5: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl:18](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl?l=18&cl=513091613):5: initialization of module 'apple/internal/transition_support.bzl' failed and referenced by '//external:grpc_python_plugin'
ERROR: C:/[workspace/tensorflow/BUILD:1093](https://cs.corp.google.com/piper///depot/google3/workspace/tensorflow/BUILD?l=1093&cl=513091613):11: error loading package '@com_github_grpc_grpc//': at C:/[tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:28](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl?l=28&cl=513091613):6: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl:22](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl?l=22&cl=513091613):5: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl:18](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl?l=18&cl=513091613):5: initialization of module 'apple/internal/transition_support.bzl' failed and referenced by '//tensorflow:grpc++'
ERROR: C:/[workspace/tensorflow/tsl/BUILD:466](https://cs.corp.google.com/piper///depot/google3/workspace/tensorflow/tsl/BUILD?l=466&cl=513091613):11: error loading package '@com_github_grpc_grpc//': at C:/[tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:28](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl?l=28&cl=513091613):6: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl:22](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl?l=22&cl=513091613):5: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl:18](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl?l=18&cl=513091613):5: initialization of module 'apple/internal/transition_support.bzl' failed and referenced by '//tensorflow/tsl:grpc++'
ERROR: C:/[workspace/tensorflow/BUILD:1084](https://cs.corp.google.com/piper///depot/google3/workspace/tensorflow/BUILD?l=1084&cl=513091613):11: error loading package '@com_github_grpc_grpc//': at C:/[tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:28](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl?l=28&cl=513091613):6: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl:22](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/ios.bzl?l=22&cl=513091613):5: at C:/[tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl:18](https://cs.corp.google.com/piper///depot/google3/tmp/hgi62d3r/external/build_bazel_rules_apple/apple/internal/testing/build_test_rules.bzl?l=18&cl=513091613):5: initialization of module 'apple/internal/transition_support.bzl' failed and referenced by '//tensorflow:grpc'

Since you are the POC for bazel, do you know the reason for these failures? Looks like we also need to update com_github_grpc_grpc version, do you have a recommended one? Thanks

yea the update is necessary for xcframeworks to work at all, but it requires bazel 6.x to build these targets which allows transitioning on that flag and therefore sidesteps things. i don't think we need a grpc update i think that is just error noise because of the first error

hrm but yea maybe loading this through older codepaths also means we'd need bazel  6.x, are there plans to update TF to that now that it's been out for a while?

hrm but yea maybe loading this through older codepaths also means we'd need bazel 6.x, are there plans to update TF to that now that it's been out for a while?

I'll ask TF OSS team if it is okay to switch to bazel 6.0.0. Thanks!

hrm but yea maybe loading this through older codepaths also means we'd need bazel 6.x, are there plans to update TF to that now that it's been out for a while?

I'll ask TF OSS team if it is okay to switch to bazel 6.0.0. Thanks!

Update on this. The TF OSS team is working on this.

Hi @keith Can you please resolve conflicts? Thank you!

hrm but yea maybe loading this through older codepaths also means we'd need bazel 6.x, are there plans to update TF to that now that it's been out for a while?

I'll ask TF OSS team if it is okay to switch to bazel 6.0.0. Thanks!

Update on this. The TF OSS team is working on this.

This issue is resolved now.

Yep thanks! I still had to bump rules_swift here, but I dropped the other updates

Hi Really sorry for the long delay, I submitted the CL with some fix.

thanks!

authors: gbaned keith yishuangP


text:
Contribute tensorflow audio model for marathi numbers 1 through 40

Contribute tensorflow model for identifying marathi numbers 1 through 40 from audio recording.
Any pull request you open is subject to the TensorFlow Hub Terms of Service at www.tfhub.dev/terms and Google's Privacy Policy at https://www.google.com/policies/privacy.
We check modified Markdown files for validity using this GitHub Workflow. You can execute the same checks locally by passing the file paths of modified Markdown files (relative to the assets/docs directory) to validator.py e.g. python3 ./tools/validator.py google/google.md google/models/albert_base/1.md ....

@sameermahajan {sameer.s.mahajan@gmail.com}

@WGierke does it look good now? If so, can you approve so that I can merge?

@sameermahajan at https://www.tensorflow.org/hub/writing_documentation  you can find that you first need to create a Markdown file for you (the publisher) at assets/docs/<publisher_id>/<publisher_id.md>. I propose to first submit that PR so your subsequent PRs can automatically trigger the GitHub Actions.
In your second PR (that contributes the Markdown file for the model), you'd have to add a file at assets/docs/<publisher_id>/<model_name>/1.md that follows the format from https://www.tensorflow.org/hub/writing_documentation#model and that references from where your SavedModel should be uploaded to tfhub.dev.
Please also see the output of the Documentation markdown validator for guidance on what to adapt.

@WGierke raised https://github.com/tensorflow/tfhub.dev/pull/150 as per you suggestion to get started

@WGierke how do I make my model.tar.gz accessible to your robot? The raw path to my github file is giving an error... I cannot share it on my google drive as it doesn't preserve the .tar.gz extension. Various URL shorteners also don't allow . in their custom paths. Do you have any server where I can upload it and provide that path?

I also tried uploading my model .tar.gz to dropbox and sharing it from there are as https://www.dropbox.com/scl/fi/l6hzfs9m5as8cydxpx3kc/marathi-40.tar.gz when I get this error __main__.MarkdownDocumentationError: Found the following errors: {'sameermahajan/marathi-numbers-1-40/1.md': 'Could not read tarfile: not a gzip file'}

@WGierke I am currently getting an error of:
__main__.MarkdownDocumentationError: Found the following errors: {'sameermahajan/marathi-numbers-1-40/1.md': 'File cannot be used by SavedModel: marathi-40/fingerprint.pb'}
How do I construct the tar.gz? I tared the contents of:
variables(Directory)
fingerprint.pb(File)
keras_metadata.pb(File)
saved_model.pb(File)

generated by
model.save

@WGierke hurray! I have managed to go through all the checks! Please let me know if you need anything else from me to approve the merge.

Thank you, @sameermahajan ! Sorry for the delay - I'll merge the PR now.

Hi @sameermahajan it seems like the model wasn't available anymore when we tried to download it. Could you double-check whether it's still up? Doing
curl http://34.234.71.96:8000/marathi-40.tar.gz

results in a timeout for me.

@WGierke oops... I thought the model is already picked up by your robot and archived in the repo. We restart the machine nightly (IST) and get different public IP every time. I can assign an elastic IP if that helps. Please let me know when you would like to connect. Can we schedule some day Indian Standard Time? The model is also in my repo https://github.com/sameermahajan/ML-Audio-Models/raw/main/tensorflow/marathi-40.tar.gz though github prevents crawling of such "raw" paths.

@sameermahajan Sorry for the confusion! I manually uploaded the archive from the GitHub URL. It will take some time until https://tfhub.dev/sameermahajan/marathi-numbers-1-40/1 is live. Thanks again for your contribution!

@WGierke thanks a lot for your help throughout the process.

authors: WGierke sameermahajan

license_source: bigquery


text:
Added MiDaS v2.1

Update MiDaS v2 to v2.1: https://github.com/intel-isl/MiDaS#accuracy

Large model: +10% accuracy
Small model: 50x times faster than previous small model on Mobile Android/iOS (with about the same accuracy as the previous small model from the paper), it is real-time for Mobile devices

By opening this pull request, you are agreeing to the TensorFlow Hub Terms of Service at www.tfhub.dev/terms, and your pull request is being reviewed.

@maringeo Thanks, I fixed it.

In the current state of the PR, intel/midas/v2_1/1 and intel/midas/v2_1/2 represent two versions of the same model. There might be a more appropriate TF Hub concept we can use to represent the relationship between these models. What is the difference between intel/midas/v2_1/1 and intel/midas/v2_1/2.

intel/midas/v2_1/1 - is a large model with high accuracy
intel/midas/v2_1/2 - is a small model with high speed (30 FPS on iPhone)

intel/midas/v2_1/1 - is a large model with high accuracy
intel/midas/v2_1/2 - is a small model with high speed (30 FPS on iPhone)

Thanks @AlexeyAB, in that case these are two separate models and require different handles (handles are the unique idenitifiers for a model, namely intel/midas/v2_1/1 and intel/midas/v2_1/2). If two handles differ only at the last number they would be intepreted as different versions of the same model (the last number in a handle is the version of the model).
One common naming pattern used in tfhub.dev is to append _large suffix to the large model name and _small suffix to the small model name. Of course this doesn't allow for a lot of flexibility if a third variant of the model comes up. So if you can think of a more meaninful model property to append to the name it would be great.
Sorry, one follow-up question: how do these two models relate to this one
https://github.com/tensorflow/tfhub.dev/blob/master/assets/docs/intel/midas/v2/1/1.md

@maringeo
Should I name it:
intel/midas/v2_1/1_large and intel/midas/v2_1/1_small ?

Sorry, one follow-up question: how do these two models relate to this one
https://github.com/tensorflow/tfhub.dev/blob/master/assets/docs/intel/midas/v2/1/1.md

This is the old large model
In this PR:

New large model - the same structure, but new weights: +10% accuracy
Small model - different structure and weights.

Thanks for the quick reply @AlexeyAB, I think the PR looks good now. Before merging, I've outlined a few refactorings that are required because of how the TF Hub model publishing pipeline is structured.
If the new large model has the same structure and provides better accuracy I think it should be published as a second version to the already existing assets/docs/intel/midas/v2/1/1.md. This will group the two models in the UI and will allow users to quickly discover the newer version of the model.
In order to add the new large model as second version of assets/docs/intel/midas/v2/1/1.md we should:

rename the file from 1.md to 2.md
move the file in the assets/docs/intel/midas/v2/1/ directory
change the first line of 2.md to be # Module intel/midas/v2/2 and also update the parent-model in the Lite .md file
optionally describe what changed between version 1 and version 2 in the 2.md documentation(https://tfhub.dev/google/universal-sentence-encoder-large/5 has a nice changelog example)

Regarding the name/handle of the small model - I think intel/midas/v2_1_small/1 or intel/midas_small/v2_1/1 are both meaningful and will work (intel/midas/v2_1/1_small won't work since the last part of the handle is the version and it should be an integer and in this example it's 1_small). Optionally, you can update the directory path to match the model handle.
Let me know if you run into any problems or if you have any questions.

@maringeo Thanks. Please check if everything is correct now.

Thanks @AlexeyAB, everything looks good. I'll merge the PR and I'll add a comment on this thread once the models are live on https://tfhub.dev/.

The models are live at:
https://tfhub.dev/intel/midas/v2_1_small/1
https://tfhub.dev/intel/lite-model/midas/v2_1_small/1/lite/1
https://tfhub.dev/intel/midas/v2/2

authors: AlexeyAB maringeo


text:
Mark all subgraph inputs as used in the memory allocator

This fixes a bug introduced in https://github.com/tensorflow/tflite-micro/pull/947 when there are multiple subgraphs and one of the non-main subgraphs (e.g. through a while loop) has inputs that aren't used. The memory planner did not mark these inputs as used, but the while-loop implementation does make copies from one subgraph to another. Without this fix it would cause writes to other memory addresses, resulting in incorrect results if unlucky.
This bug could be triggered when running the following Keras model (converted to TFLite) with TFLite Micro:

class SimpleWhileLoop(tf.keras.layers.Layer):
    def __init__(self):
        super(SimpleWhileLoop, self).__init__()

    def call(self, inputs):

        def body(counter, data):
            return counter * 2, data * 2

        def condition(counter, data):
            return counter < 10

        i = tf.constant(1, dtype=tf.int32)
        i, result = tf.while_loop(condition, body, [i, inputs])
        return result

def get_model() -> tf.keras.Model:
    input_layer = tf.keras.layers.Input(shape=(3, 4), batch_size=1)
    x = SimpleWhileLoop()(input_layer)
    return tf.keras.Model(input_layer, x, name="while_test")

Before this PR, at the start of the while loop (in micro/kernels/while.cc:85) the initial counter value (1) would be copied to the condition subgraph, but then right after all the 12 data values would be copied as well, although they are unused. Debugging showed that the address of the loop counter was in the middle of the planned range of the data values, thus causing the counter value to be overwritten by the data. With this PR that no longer happens, although I can't be 100% sure that the bug is solved: it could be luck with the way the memory plan turned out to be. However, conceptually this fix makes sense to me so I'm sending this PR.

I think the same fix has been applied a month ago here: https://github.com/tensorflow/tflite-micro/commit/7925e839c75a1d0b165150b128ba8ec88dcec031

authors: CNugteren Tombana

repo: tensorflow/tflite-micro


text:
Masking system and general RC additions

Source files for the docs
Integrate masking system
All tests running

#106

repo: tensorops/TransformerX

license: MIT


text:
[FEATURE REQUEST] Read checkout to be able to read data from staging area

Is your feature request related to a problem? Please describe.
Currently, read checkout won't be able to read data from the staging area. I was wondering what would be the technical difficulties for reading data from staging area
Describe the solution you'd like
repo.checkout(stage=True) or something similar could give access to the staging area. I think the major bottleneck from implementing this is the fact that the staging area could change and might even make the data unavailable. Maybe we could have a flag changes when the data changes and on read from a stage checkout, it could let the reading process know that the data changed (not the specific information but just that the data changed) and it can invalidate the checkout?

This isn't the craziest thing to do from a technical standpoint, but I'm wondering what the motivation for allowing this is?

authors: hhsecond rlizzo

repo: tensorwerk/hangar-py


text:
tt_lib.operations.primary.add_layernorm operation breaks when no weight and bias provided [Wormhole]

tt_lib.operations.primary.add_layernorm operation breaks in test cases when weight and bias are not provided,
To Reproduce
Steps to reproduce the behavior:

Checkout main branch
Run unit test test_add_layernorm_noweights.py using this command:
 pytest tests/tt_eager/python_api_testing/non_working_unit_tests/grayskull/test_add_layernorm_noweights.py
[Same unit as for grayskull]

Expected behavior

There are 4 test cases presented in the unit test test_add_layernorm_noweights.py and they all are expected to fail with the following error message
RuntimeError: bad optional access
Additional context
To get additional information and results for different combinations of input shapes, types, layouts and memory configs for which this operation was tested you can also run locally sweeps for ttl.tensor.ne and check the results. To do this you should:

Follow the Getting Started page to setup the repo, environment variables and python-env
Activate source build/python_env/bin/activate
Run sweeps by using python tests/tt_eager/python_api_testing/sweep_tests/run_pytorch_test.py -i tests/tt_eager/python_api_testing/sweep_tests/test_configs/ci_sweep_tests/broken_wormhole/pytorch_add_layernorm_noweights_test.yaml -o ./result-sweeps
After the run is completed all test sweeps results should be available inside specified output directory (in this case ./result-sweeps). There you will find add_layernorm_noweights_sweep.csv which holds all executed sweeps, among which you can also find the ones that failed and were recreated by the unit test, which you can get by searching unique data_seed field.

Fixed in the meantime.

repo: tenstorrent-metal/tt-metal


text:
EDM Low Level Optimizations

[ ] #6301

Make the eth receiver first level ack send and worker notify a single state with multiple concurrent tasks (each can make progress independently).

[ ] #6302
[ ] Use erisc IRAM

Doing some lower level profiling of the EDM and I'm seeing this. We're really hurt by the ETH CMD Q not being ready to accept more payloads. We're basically losing 1us in the snapshot here where the message could be queued up and erisc would be able to handle additional work. Enabling the second eth cmd q may help with this.

Bumping up priority based on above observations

Another observation is I'm seeing is the loop overhead (of checking if other channels made progress and need further worker) is way too high here. I'm seeing 800ns spent turning around an ack for a single read request. End to end this is on the order of 1us for a worker to get a signal from EDM of payload available to when the ack signal is received by that EDM.

repo: tenstorrent/tt-metal


text:
#9714: Move SD device perf test to last because it's unstable

Another separate device pipeline for unstable tests right now would take away too many precious cycles from the single WH perf machine we have
Ticket
#9714
Problem description
Stable diffusion errors / hangs frequently, preventing other tests from running.
What's changed
Moved SD to last test so others can run.
Checklist

[x] Post commit CI passes
[x] Model regression CI testing passes (if applicable)
[x] New/Existing tests provide coverage for changes

Closing because we're just skipping it for now in light of di/dt.
It may still be hanging.


text:
copy and link favicon to editor

Pull Request Template
Description
hey, this fix is for the editor's favicon this time
Fixes # (issue)
Type of change
Please delete options that are not relevant.

[x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
I have checked to see that this now works for the editor.
Checklist:

[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
[x] New and existing unit tests pass locally with my changes
[ ] Any dependent changes have been merged and published in downstream modules
[x] I have checked my code and corrected any misspellings

Hello, has merging this pull request been considered yet?

repo: tentone/nunuStudio


text:
AdActivity is not shown properly

For instance if I show an AppOpenAd first and then I attempt to show an InterestitialAd it will be shown above the app-open-ad.

Indeed. This happens due to #55 - a fix will be implemented

authors: teogor zeoowl-dev

repo: teogor/ceres


text:
change path of the native library to be automatically detected

change path of the native library to be automatically detected

should fix #13 on linux


text:
switch back to select() as poll() is broken on implementations like mac OS

closes #31
The benefits of using poll() for 2 file descriptors are negligible so we should just switch back to select() for portability across broken platforms

Thanks @git-bruh

authors: adsr git-bruh


text:
Add File support for JSON SPDX Documents

A previous commit, bca41a2, added support for a SPDX JSON format.
While that commit does produce technically valid JSON documents,
it, embarrassingly, wasn't thoroughly tested in conjunction with a
file-level external  analysis tool like scancode.
This PR adds previously missing functionality that is
necessary for Tern to produce SPDX JSON documents that
successfully validate when file level information is available.
In particular, these commit do the following:

Updates a few spdxtagvalue file-related functions that were
referencing the wrong location of a common function (oversight from
some refactoring done in commit 87f1c29.)

Uses the LicenseRef for File licenses in the document. File
level licenses were previously appearing as plain text
(i.e "Public Domain" instead of a unique SPDX LicenseRef).
The plain text was causing validation errors in some cases.

Adds extractedText information to the
SPDX JSON document. This is necessary to provide a copy of the
actual text of the licenses reference extracted from the file
that is associated with the License Identifier and aids in future
analysis.

Hi, I've tried to check it via:
tern -c report -f spdxjson -o outputspdxjson -i "golang:latest"
got:
2021-01-14 13:12:38,553 - ERROR - report - spdxjson not a recognized plugin.

Hi, I've tried to check it via:
tern -c report -f spdxjson -o outputspdxjson -i "golang:latest"
got:
2021-01-14 13:12:38,553 - ERROR - report - spdxjson not a recognized plugin.

Hi, I've tried to check it via:
tern -c report -f spdxjson -o outputspdxjson -i "golang:latest"
got:
2021-01-14 13:12:38,553 - ERROR - report - spdxjson not a recognized plugin.
and just to be sure:
git status
On branch add-json-file-support

Likely you need to pull the latest changes from master first. https://github.com/tern-tools/tern/pull/854 was merged a few days ago which has all the preliminary spdx json support. Thanks for testing this!

Hi, I've tried to check it via:
tern -c report -f spdxjson -o outputspdxjson -i "golang:latest"
got:
2021-01-14 13:12:38,553 - ERROR - report - spdxjson not a recognized plugin.
and just to be sure:
git status
On branch add-json-file-support

Likely you need to pull the latest changes from master first. https://github.com/tern-tools/tern/pull/854 was merged a few days ago which has all the preliminary spdx json support. Thanks for testing this!

Yeah, I checked git log and the checkout was correct, which tern returned the correct one from the venv (i did pip3 install .)  Fresh clone helped though, wonder what went wrong, previously I went git remote add then git checkout.
Got report in plain format, running it with scancode now

Yeah, I checked git log and the checkout was correct, which tern returned the correct one from the venv (i did pip3 install .)  Fresh clone helped though, wonder what went wrong, previously I went git remote add then git checkout.
Got report in plain format, running it with scancode now

@aalexanderr FYI If you want to try validating the spdx json document created you can download the tool here:
https://bintray.com/spdx/spdx-tools/download_file?file_path=org%2Fspdx%2Ftools-java%2F0.0.4%2Ftools-java-0.0.4-jar-with-dependencies.jar
and then run: java -jar ~/tools-java-0.0.4-jar-with-dependencies.jar Verify output.json
Note that your document should have the ".json" filetype (i.e. filename.json)

@aalexanderr FYI If you want to try validating the spdx json document created you can download the tool here:
https://bintray.com/spdx/spdx-tools/download_file?file_path=org%2Fspdx%2Ftools-java%2F0.0.4%2Ftools-java-0.0.4-jar-with-dependencies.jar
and then run: java -jar ~/tools-java-0.0.4-jar-with-dependencies.jar Verify output.json
Note that your document should have the ".json" filetype (i.e. filename.json)

On image golang:latest I'm getting multiple instances of some licenses
the verification tool complains about:
Analysis exception processing SPDX file: ID LicenseRef-5fc4e2a already exists.
But from a quick scroll-through I've seen more duplications in the  "hasExtractedLicensingInfos":  (which I assume to be the culprit)

On image golang:latest I'm getting multiple instances of some licenses
the verification tool complains about:
Analysis exception processing SPDX file: ID LicenseRef-5fc4e2a already exists.
But from a quick scroll-through I've seen more duplications in the  "hasExtractedLicensingInfos":  (which I assume to be the culprit)

On image golang:latest I'm getting multiple instances of some licenses
the verification tool complains about:
Analysis exception processing SPDX file: ID LicenseRef-5fc4e2a already exists.
But from a quick scroll-through I've seen more duplications in the "hasExtractedLicensingInfos": (which I assume to be the culprit)

Thank you! Let me take a look.

On image golang:latest I'm getting multiple instances of some licenses
the verification tool complains about:
Analysis exception processing SPDX file: ID LicenseRef-5fc4e2a already exists.
But from a quick scroll-through I've seen more duplications in the "hasExtractedLicensingInfos": (which I assume to be the culprit)

Thank you! Let me take a look.

@aalexanderr the duplicate license ref issue is fixed. Thanks for catching that! I am going to push the  changes along with another fix for a FileType issue I found. Would you mind re-testing it? (maybe with a fresh clone to be safe)

@aalexanderr the duplicate license ref issue is fixed. Thanks for catching that! I am going to push the  changes along with another fix for a FileType issue I found. Would you mind re-testing it? (maybe with a fresh clone to be safe)

for golang:latest
This SPDX Document is valid.

for golang:latest
This SPDX Document is valid.

for golang:latest
This SPDX Document is valid.

Thank you @aalexanderr! Appreciate your help on this.

for golang:latest
This SPDX Document is valid.

Thank you @aalexanderr! Appreciate your help on this.

authors: aalexanderr rnjudge

repo: tern-tools/tern


text:
Terra.js not work in React Native

I create a new React Native project, then install @terra-money/terra.js node-libs-react-native react-native-get-random-values.
Set up metro.config.js and import 'node-libs-react-native/globals' & 'react-native-get-random-values' in index.js.
When next react-native run-android, I got this error. What should I do, downgrade tiny-secp256k1, or have something else parser way?

I add 'cjs' in sourceExts (metro.config.js).
but got several library not found, so add some require.resolve in extraNodeModules (metro.cofig.js).
After I have done above,  other err cause

v3.0.10 has issue with tiny-secp256k1. we'll release new version with its fix soon.
before that, i think you can try with v3.0.9.

tiny-secp256k1 was reverted. v3.0.11 will work.

authors: CYCken Vritra4 hanjukim


text:
create_and_sign_tx - AttributeError: 'BlockTxBroadcastResult' object has no attribute 'encode'

terra_sdk version: 2.0.4
Python version: 3.9.7
Operating System: Ubuntu 20.04

Description
I am trying to deploy cw20 token to Local Terra, but when executing contract I get attribute error.
What I Did
from terra_sdk.client.lcd.api.tx import CreateTxOptions
from terra_sdk.client.localterra import LocalTerra
from terra_sdk.util.contract import get_code_id, read_file_as_b64
from terra_sdk.core.wasm import MsgStoreCode, MsgInstantiateContract, MsgExecuteContract
from terra_sdk.core.coins import Coins
from terra_sdk.core.fee import Fee

lt = LocalTerra()
deployer = lt.wallets["test1"]
test_acc = lt.wallets["test2"]

def store_contract(contract_name):
    contract_bytes = read_file_as_b64(f"artifacts/{contract_name}.wasm")
    store_code = MsgStoreCode(deployer.key.acc_address, contract_bytes)
    tx = deployer.create_and_sign_tx(CreateTxOptions(
        msgs=[store_code]
    ))
    result = lt.tx.broadcast(tx)
    code_id = get_code_id(result)
    return code_id

def instantiate_contract(code_id: str, init_msg: dict) -> str:
    instantiate = MsgInstantiateContract(
        sender=deployer.key.acc_address,
        admin=deployer.key.acc_address,
        code_id=code_id,
        init_msg=init_msg,
    )

    tx = deployer.create_and_sign_tx(CreateTxOptions(
        msgs=[instantiate]
    ))

    result = lt.tx.broadcast(tx)
    print(result)
    return result

def execute_contract(sender, contract_addr: str, execute_msg):

    execute = MsgExecuteContract(
        sender=sender.key.acc_address, contract=contract_addr, execute_msg=execute_msg
    )
    # tx = sender.create_and_sign_tx(CreateTxOptions(
    #     msgs=[execute],
    #     fee=Fee(1000000, "1000000uluna")
    # ))
    execute = MsgExecuteContract(
        sender.key.acc_address,
        contract_addr,
        execute_msg,
        {"uluna": 100000},
    )

    execute_tx = sender.create_and_sign_tx(
        CreateTxOptions(msgs=[execute], fee=Fee(1000000, Coins(uluna=1000000)))
    )

    result = lt.tx.broadcast(execute_tx)
    print(result)
    return result

code_id = store_contract("terraswap_token")
contract_address = instantiate_contract(code_id,
                                        {
                                            "name": "Test Terra Token",
                                            "symbol": "TTT",
                                            "decimals": 6,
                                            "initial_balances": [
                                                {"address": deployer.key.acc_address,
                                                    "amount": "1000000000"}
                                            ]
                                        })

execute_contract(deployer, contract_address, {
    "transfer": {
        "recipient": test_acc.key.acc_address,
        "amount": "50000000000"
    }
})

print(lt.wasm.contract_query(contract_address, {
      "balance": {"address": deployer.key.acc_address}}))

print(lt.wasm.contract_query(contract_address, {
      "balance": {"address": test_acc.key.acc_address}}))

What was the error?

(base) josh@jmachine:~/Matrix/Code/BlockchainDev/Rust/terra-contract-tubbly$ python deploy_contract.py
BlockTxBroadcastResult(height=35, txhash='07237D239DC291125BE1316E61B054A1A06D5AB4651E3B6269966CFEC862A1D6', raw_log='[{"events":[{"type":"instantiate_contract","attributes":[{"key":"creator","value":"terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v"},{"key":"admin","value":"terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v"},{"key":"code_id","value":"1"},{"key":"contract_address","value":"terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5"}]},{"type":"message","attributes":[{"key":"action","value":"/terra.wasm.v1beta1.MsgInstantiateContract"},{"key":"module","value":"wasm"},{"key":"sender","value":"terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v"}]}]}]', gas_wanted=486255, gas_used=290963, logs=[TxLog(msg_index=0, log='', events=[{'type': 'instantiate_contract', 'attributes': [{'key': 'creator', 'value': 'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v'}, {'key': 'admin', 'value': 'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v'}, {'key': 'code_id', 'value': '1'}, {'key': 'contract_address', 'value': 'terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5'}]}, {'type': 'message', 'attributes': [{'key': 'action', 'value': '/terra.wasm.v1beta1.MsgInstantiateContract'}, {'key': 'module', 'value': 'wasm'}, {'key': 'sender', 'value': 'terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v'}]}], events_by_type={'instantiate_contract': {'creator': ['terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v'], 'admin': ['terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v'], 'code_id': ['1'], 'contract_address': ['terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5']}, 'message': {'action': ['/terra.wasm.v1beta1.MsgInstantiateContract'], 'module': ['wasm'], 'sender': ['terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v']}})], code=0, codespace='', info=None, data=None, timestamp=None)
Traceback (most recent call last):
  File "/home/josh/Matrix/Code/BlockchainDev/Rust/terra-contract-tubbly/deploy_contract.py", line 78, in <module>
    execute_contract(deployer, contract_address, {
  File "/home/josh/Matrix/Code/BlockchainDev/Rust/terra-contract-tubbly/deploy_contract.py", line 57, in execute_contract
    execute_tx = sender.create_and_sign_tx(
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/client/lcd/wallet.py", line 130, in create_and_sign_tx
    return self.key.sign_tx(
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/key/key.py", line 226, in sign_tx
    signature: SignatureV2 = self.create_signature(signDoc)
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/key/key.py", line 183, in create_signature
    signature = self.sign(sign_doc.to_bytes())
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/core/sign_doc.py", line 78, in to_bytes
    return bytes(self.to_proto())
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/core/sign_doc.py", line 71, in to_proto
    body_bytes=bytes(self.tx_body.to_proto()),
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/core/tx.py", line 175, in to_proto
    messages=[m.pack_any() for m in self.messages],
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/core/tx.py", line 175, in <listcomp>
    messages=[m.pack_any() for m in self.messages],
  File "/home/josh/miniconda3/lib/python3.9/site-packages/terra_sdk/core/msg.py", line 13, in pack_any
    return Any_pb(type_url=self.type_url, value=bytes(self.to_proto()))
  File "/home/josh/miniconda3/lib/python3.9/site-packages/betterproto/__init__.py", line 815, in __bytes__
    output += _serialize_single(
  File "/home/josh/miniconda3/lib/python3.9/site-packages/betterproto/__init__.py", line 396, in _serialize_single
    value = _preprocess_single(proto_type, wraps, value)
  File "/home/josh/miniconda3/lib/python3.9/site-packages/betterproto/__init__.py", line 364, in _preprocess_single
    return value.encode("utf-8")
AttributeError: 'BlockTxBroadcastResult' object has no attribute 'encode'

your instantiate_contract() doesn't return contract_address.
you have to get contract address from result like https://github.com/terra-money/terra.py/blob/9fa0c386ae3aa7f748f9c72d6302257a8d556f66/integration_tests/contract.py#L47


text:
Political ware breaks Atlantis module

Trying to use a module-generated SSL Certificate via the Atlantis module does not work.
The module referenced has been updated to political-ware, and this breaks the Atlantis module. Suggest limiting the "acm" module version to v3.3.0.
With any later version, we get the error: Error: importing ACM Certificate: operation error ACM: ImportCertificate, https response error StatusCode: 400, RequestID: a7780e22-3f96-426f-8d21-3a7957c12b59, api error ValidationException: 2 validation errors detected: Value at 'privateKey' failed to satisfy constraint: Member must have length greater than or equal to 1; Value at 'certificate' failed to satisfy constraint: Member must have length greater than or equal to 1. This results because you can't define the political variables required to set create_ to true.

please use the issue template provided and supply the requested details

Alternatively, you can just not use these modules if you don't like "politics" in these modules... it is simple...

authors: antonbabenko bryantbiggs lsq-ablair