-
Notifications
You must be signed in to change notification settings - Fork 2k
Add reduce and made some changes as requested #2617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| import {FusedConv2DConfig} from '@tensorflow/tfjs-core/dist/ops/fused_util'; | ||
| // TODO TODO to import computeOptimalWindowSize and other reduce_util function | ||
| // from backend_util, rather than from 'dist' | ||
| import {assertAxesAreInnerMostDims, computeOutAndReduceShapes} from '@tensorflow/tfjs-core/src/ops/axis_util'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can delete this import and the "TODO" comment above, and call backend_util.assertAxesAreInnerMostDims and backend_util.computeOutAndReduceShapes - they are already exported as part of backend_util.
annxingyuan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @NALLEIN ! I just left a few more tiny comments - sorry to be tedious but I just want to make sure we minimize imports from non-public API whenever possible. Very excited to merge this soon!
tfjs-core/src/index.ts
Outdated
| export {Scalar, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D, Tensor5D, TensorBuffer, Variable} from './tensor'; | ||
| export {GradSaveFunc, NamedTensorMap, TensorContainer, TensorContainerArray, TensorContainerObject} from './tensor_types'; | ||
| export {DataType, DataTypeMap, DataValues, Rank, RecursiveArray, ShapeMap, TensorLike} from './types'; | ||
| // TODO : import sumOutType directly from '@tensorflow/tfjs-core'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this TODO statement and move to backend_webgpu.ts:28 instead.
| export * from '../ops/conv_util'; | ||
| export {Activation, FusedConv2DConfig} from '../ops/fused_util'; | ||
|
|
||
| // TODO : use backend_util.reduce_util with the next release of tfjs-core. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this TODO statement to backend_webgpu.ts:27 instead.
|
FYI, with this change, I met below errors. Do you need to update the tfjs-core version? |
| export {Scalar, Tensor, Tensor1D, Tensor2D, Tensor3D, Tensor4D, Tensor5D, TensorBuffer, Variable} from './tensor'; | ||
| export {GradSaveFunc, NamedTensorMap, TensorContainer, TensorContainerArray, TensorContainerObject} from './tensor_types'; | ||
| export {DataType, DataTypeMap, DataValues, Rank, RecursiveArray, ShapeMap, TensorLike} from './types'; | ||
| export {DataType, DataTypeMap, DataValues, Rank, RecursiveArray, ShapeMap, sumOutType, TensorLike} from './types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this introduces a top-level tf.sumOutType method, which we don't want as part of our API since we are aligning with TF Python. All the other exports from './types' are interfaces/types that do not exist at runtime. We should instead expose sumOutType as part of the backend_util namespace.
[webgpu] Add sub, abs, min, max kernels. #2365
Made some changed as requested and rebase this branch.
To see the logs from the Cloud Build CI, please join either our [discussion]
(https://groups.google.com/a/tensorflow.org/forum/#!forum/tfjs) or announcement mailing list.
This change is