Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for daniel_s
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #289625 |
Post edited: |
— | about 1 year ago |
Comment | Post #289613 |
Yes. Tensorflow is intended to be executed on GPUs or TPUs, special hardware for doing calculations in parallel. The marker for executing it in parallel is the @tf.function decorator. Inside functions which have this decorator, (when executed on a GPU or TPU) you can't use all standard python modules... (more) |
— | about 1 year ago |
Comment | Post #289625 |
After more testing of lin_to_db I realized it doesn't work in all places with the pure tensorflow version, because it always returns a tf.Tensor, no matter if the input is a tf.Tensor or a float. But some subsequent code (in my case, json.dumps) can't handle tf.Tensor:
TypeError: Object of type Eage... (more) |
— | about 1 year ago |
Comment | Post #289625 |
Cool, you're right, at least for lin_to_db I can indeed use just the tensorflow version.
The other one is a bit more tricky, because I have variables which contain values that get written before graph execution and they get read during graph execution and afterwards. I don't want to duplicate them... (more) |
— | about 1 year ago |
Edit | Post #289625 |
Post edited: |
— | about 1 year ago |
Edit | Post #289625 | Initial revision | — | about 1 year ago |
Question | — |
Best practices to write functions for both execution modes in Tensorflow, eager and graph mode I regularly run into the problem that I have a Python function that I want to use in both, eager and graph execution mode. I therefore have to adjust the code so that it can handle both situations. Here are two examples: ```python import tensorflow as tf ``` ```python def lintodb(x: float | tf... (more) |
— | about 1 year ago |
Edit | Post #289613 | Initial revision | — | about 1 year ago |
Question | — |
Can't use tf.timestamp() from within @tf.function with XLA / jit_compile=True I would like to use `tf.timestamp()` when it is available (eager mode and graph mode without XLA), and use `0.` (or a better fallback if there is one) when it is not available (with XLA; `@tf.function(jitcompile=True)`). I tried this: def tftimestamporzero(): try: retu... (more) |
— | about 1 year ago |
Edit | Post #289588 |
Post edited: |
— | about 1 year ago |
Edit | Post #289588 |
Post edited: |
— | about 1 year ago |
Edit | Post #289588 |
Post edited: |
— | about 1 year ago |
Edit | Post #289588 | Initial revision | — | about 1 year ago |
Question | — |
Is it okay to use python operators for tensorflow tensors? TL;DR - Is `(a and b)` equivalent to `tf.logicaland(a, b)` in terms of optimization and performance? (`a` and `b` are tensorflow tensors) Details - I use Python with Tensorflow. My priorities are 1. Make the code run fast 2. Make it readable. I have working and fast code that, for my ... (more) |
— | about 1 year ago |