mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-12 00:59:23 +00:00
[js/webgpu] allow uint8 tensors for webgpu (#19545)
### Description allow uint8 tensors for webgpu
This commit is contained in:
parent
4874a41008
commit
06269a3952
3 changed files with 4 additions and 3 deletions
|
|
@ -103,7 +103,7 @@ export class Tensor implements TensorInterface {
|
|||
}
|
||||
case 'gpu-buffer': {
|
||||
if ((type !== 'float32' && type !== 'float16' && type !== 'int32' && type !== 'int64' && type !== 'uint32' &&
|
||||
type !== 'bool')) {
|
||||
type !== 'uint8' && type !== 'bool')) {
|
||||
throw new TypeError(`unsupported type "${type}" to create tensor from gpu buffer`);
|
||||
}
|
||||
this.gpuBufferData = arg0.gpuBuffer;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ export declare namespace Tensor {
|
|||
/**
|
||||
* supported data types for constructing a tensor from a WebGPU buffer
|
||||
*/
|
||||
export type GpuBufferDataTypes = 'float32'|'float16'|'int32'|'int64'|'uint32'|'bool';
|
||||
export type GpuBufferDataTypes = 'float32'|'float16'|'int32'|'int64'|'uint32'|'uint8'|'bool';
|
||||
|
||||
/**
|
||||
* represent where the tensor data is stored
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ export const logLevelStringToEnum = (logLevel?: 'verbose'|'info'|'warning'|'erro
|
|||
* Check whether the given tensor type is supported by GPU buffer
|
||||
*/
|
||||
export const isGpuBufferSupportedType = (type: Tensor.Type): type is Tensor.GpuBufferDataTypes => type === 'float32' ||
|
||||
type === 'int32' || type === 'int64' || type === 'bool' || type === 'float16' || type === 'uint32';
|
||||
type === 'float16' || type === 'int32' || type === 'int64' || type === 'uint32' || type === 'uint8' ||
|
||||
type === 'bool';
|
||||
|
||||
/**
|
||||
* Map string data location to integer value
|
||||
|
|
|
|||
Loading…
Reference in a new issue